diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:00:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:00:32 -0400 |
commit | e9dd2b6837e26fe202708cce5ea4bb4ee3e3482e (patch) | |
tree | f42fd892495bfc4cbb740d06b016d267c9c42d00 /include/linux/genhd.h | |
parent | 4f3a29dadaf999a273f1e7fe2476595d0283eef3 (diff) | |
parent | b4627321e18582dcbdeb45d77df29d3177107c65 (diff) |
Merge branch 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.37/core' of git://git.kernel.dk/linux-2.6-block: (39 commits)
cfq-iosched: Fix a gcc 4.5 warning and put some comments
block: Turn bvec_k{un,}map_irq() into static inline functions
block: fix accounting bug on cross partition merges
block: Make the integrity mapped property a bio flag
block: Fix double free in blk_integrity_unregister
block: Ensure physical block size is unsigned int
blkio-throttle: Fix possible multiplication overflow in iops calculations
blkio-throttle: limit max iops value to UINT_MAX
blkio-throttle: There is no need to convert jiffies to milli seconds
blkio-throttle: Fix link failure failure on i386
blkio: Recalculate the throttled bio dispatch time upon throttle limit change
blkio: Add root group to td->tg_list
blkio: deletion of a cgroup was causes oops
blkio: Do not export throttle files if CONFIG_BLK_DEV_THROTTLING=n
block: set the bounce_pfn to the actual DMA limit rather than to max memory
block: revert bad fix for memory hotplug causing bounces
Fix compile error in blk-exec.c for !CONFIG_DETECT_HUNG_TASK
block: set the bounce_pfn to the actual DMA limit rather than to max memory
block: Prevent hang_check firing during long I/O
cfq: improve fsync performance for small files
...
Fix up trivial conflicts due to __rcu sparse annotation in include/linux/genhd.h
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r-- | include/linux/genhd.h | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index af3f06b41dc1..557c3927e70f 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/kdev_t.h> | 13 | #include <linux/kdev_t.h> |
14 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
15 | #include <linux/slab.h> | ||
15 | 16 | ||
16 | #ifdef CONFIG_BLOCK | 17 | #ifdef CONFIG_BLOCK |
17 | 18 | ||
@@ -86,7 +87,15 @@ struct disk_stats { | |||
86 | unsigned long io_ticks; | 87 | unsigned long io_ticks; |
87 | unsigned long time_in_queue; | 88 | unsigned long time_in_queue; |
88 | }; | 89 | }; |
89 | 90 | ||
91 | #define PARTITION_META_INFO_VOLNAMELTH 64 | ||
92 | #define PARTITION_META_INFO_UUIDLTH 16 | ||
93 | |||
94 | struct partition_meta_info { | ||
95 | u8 uuid[PARTITION_META_INFO_UUIDLTH]; /* always big endian */ | ||
96 | u8 volname[PARTITION_META_INFO_VOLNAMELTH]; | ||
97 | }; | ||
98 | |||
90 | struct hd_struct { | 99 | struct hd_struct { |
91 | sector_t start_sect; | 100 | sector_t start_sect; |
92 | sector_t nr_sects; | 101 | sector_t nr_sects; |
@@ -95,6 +104,7 @@ struct hd_struct { | |||
95 | struct device __dev; | 104 | struct device __dev; |
96 | struct kobject *holder_dir; | 105 | struct kobject *holder_dir; |
97 | int policy, partno; | 106 | int policy, partno; |
107 | struct partition_meta_info *info; | ||
98 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 108 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
99 | int make_it_fail; | 109 | int make_it_fail; |
100 | #endif | 110 | #endif |
@@ -130,6 +140,7 @@ struct disk_part_tbl { | |||
130 | struct rcu_head rcu_head; | 140 | struct rcu_head rcu_head; |
131 | int len; | 141 | int len; |
132 | struct hd_struct __rcu *last_lookup; | 142 | struct hd_struct __rcu *last_lookup; |
143 | struct gendisk *disk; | ||
133 | struct hd_struct __rcu *part[]; | 144 | struct hd_struct __rcu *part[]; |
134 | }; | 145 | }; |
135 | 146 | ||
@@ -181,6 +192,30 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part) | |||
181 | return NULL; | 192 | return NULL; |
182 | } | 193 | } |
183 | 194 | ||
195 | static inline void part_pack_uuid(const u8 *uuid_str, u8 *to) | ||
196 | { | ||
197 | int i; | ||
198 | for (i = 0; i < 16; ++i) { | ||
199 | *to++ = (hex_to_bin(*uuid_str) << 4) | | ||
200 | (hex_to_bin(*(uuid_str + 1))); | ||
201 | uuid_str += 2; | ||
202 | switch (i) { | ||
203 | case 3: | ||
204 | case 5: | ||
205 | case 7: | ||
206 | case 9: | ||
207 | uuid_str++; | ||
208 | continue; | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | static inline char *part_unpack_uuid(const u8 *uuid, char *out) | ||
214 | { | ||
215 | sprintf(out, "%pU", uuid); | ||
216 | return out; | ||
217 | } | ||
218 | |||
184 | static inline int disk_max_parts(struct gendisk *disk) | 219 | static inline int disk_max_parts(struct gendisk *disk) |
185 | { | 220 | { |
186 | if (disk->flags & GENHD_FL_EXT_DEVT) | 221 | if (disk->flags & GENHD_FL_EXT_DEVT) |
@@ -342,6 +377,19 @@ static inline int part_in_flight(struct hd_struct *part) | |||
342 | return part->in_flight[0] + part->in_flight[1]; | 377 | return part->in_flight[0] + part->in_flight[1]; |
343 | } | 378 | } |
344 | 379 | ||
380 | static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) | ||
381 | { | ||
382 | if (disk) | ||
383 | return kzalloc_node(sizeof(struct partition_meta_info), | ||
384 | GFP_KERNEL, disk->node_id); | ||
385 | return kzalloc(sizeof(struct partition_meta_info), GFP_KERNEL); | ||
386 | } | ||
387 | |||
388 | static inline void free_part_info(struct hd_struct *part) | ||
389 | { | ||
390 | kfree(part->info); | ||
391 | } | ||
392 | |||
345 | /* block/blk-core.c */ | 393 | /* block/blk-core.c */ |
346 | extern void part_round_stats(int cpu, struct hd_struct *part); | 394 | extern void part_round_stats(int cpu, struct hd_struct *part); |
347 | 395 | ||
@@ -533,7 +581,9 @@ extern int disk_expand_part_tbl(struct gendisk *disk, int target); | |||
533 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 581 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
534 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | 582 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
535 | int partno, sector_t start, | 583 | int partno, sector_t start, |
536 | sector_t len, int flags); | 584 | sector_t len, int flags, |
585 | struct partition_meta_info | ||
586 | *info); | ||
537 | extern void delete_partition(struct gendisk *, int); | 587 | extern void delete_partition(struct gendisk *, int); |
538 | extern void printk_all_partitions(void); | 588 | extern void printk_all_partitions(void); |
539 | 589 | ||