diff options
author | Tejun Heo <tj@kernel.org> | 2008-08-25 06:47:17 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:04 -0400 |
commit | 310a2c1012934f590192377f65940cad4aa72b15 (patch) | |
tree | ed30346abf07c5a7e94719f567368d5642af1f95 /include/linux/genhd.h | |
parent | 88e341261ca4d39eec21b212961c77eff51105f7 (diff) |
block: misc updates
This patch makes the following misc updates in preparation for
disk->part dereference fix and extended block devt support.
* implment part_to_disk()
* fix comment about gendisk->part indexing
* rename get_part() to disk_map_sector()
* don't use n which is always zero while printing disk information in
diskstats_show()
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r-- | include/linux/genhd.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index be4f5e5bfe06..c64e659c9843 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -116,7 +116,7 @@ struct gendisk { | |||
116 | int minors; /* maximum number of minors, =1 for | 116 | int minors; /* maximum number of minors, =1 for |
117 | * disks that can't be partitioned. */ | 117 | * disks that can't be partitioned. */ |
118 | char disk_name[32]; /* name of major driver */ | 118 | char disk_name[32]; /* name of major driver */ |
119 | struct hd_struct **part; /* [indexed by minor] */ | 119 | struct hd_struct **part; /* [indexed by minor - 1] */ |
120 | struct block_device_operations *fops; | 120 | struct block_device_operations *fops; |
121 | struct request_queue *queue; | 121 | struct request_queue *queue; |
122 | void *private_data; | 122 | void *private_data; |
@@ -145,14 +145,21 @@ struct gendisk { | |||
145 | #endif | 145 | #endif |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static inline struct gendisk *part_to_disk(struct hd_struct *part) | ||
149 | { | ||
150 | if (likely(part)) | ||
151 | return dev_to_disk((part)->dev.parent); | ||
152 | return NULL; | ||
153 | } | ||
154 | |||
148 | /* | 155 | /* |
149 | * Macros to operate on percpu disk statistics: | 156 | * Macros to operate on percpu disk statistics: |
150 | * | 157 | * |
151 | * The __ variants should only be called in critical sections. The full | 158 | * The __ variants should only be called in critical sections. The full |
152 | * variants disable/enable preemption. | 159 | * variants disable/enable preemption. |
153 | */ | 160 | */ |
154 | static inline struct hd_struct *get_part(struct gendisk *gendiskp, | 161 | static inline struct hd_struct *disk_map_sector(struct gendisk *gendiskp, |
155 | sector_t sector) | 162 | sector_t sector) |
156 | { | 163 | { |
157 | struct hd_struct *part; | 164 | struct hd_struct *part; |
158 | int i; | 165 | int i; |