aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h13
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
148static 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 */
154static inline struct hd_struct *get_part(struct gendisk *gendiskp, 161static 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;