aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 19:47:17 +0900
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 08:56:04 +0200
commit310a2c1012934f590192377f65940cad4aa72b15 (patch)
treeed30346abf07c5a7e94719f567368d5642af1f95 /include/linux/genhd.h
parentblock: update add_partition() error handling (diff)
downloadlinux-dev-310a2c1012934f590192377f65940cad4aa72b15.tar.xz
linux-dev-310a2c1012934f590192377f65940cad4aa72b15.zip
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.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 {
int minors; /* maximum number of minors, =1 for
* disks that can't be partitioned. */
char disk_name[32]; /* name of major driver */
- struct hd_struct **part; /* [indexed by minor] */
+ struct hd_struct **part; /* [indexed by minor - 1] */
struct block_device_operations *fops;
struct request_queue *queue;
void *private_data;
@@ -145,14 +145,21 @@ struct gendisk {
#endif
};
+static inline struct gendisk *part_to_disk(struct hd_struct *part)
+{
+ if (likely(part))
+ return dev_to_disk((part)->dev.parent);
+ return NULL;
+}
+
/*
* Macros to operate on percpu disk statistics:
*
* The __ variants should only be called in critical sections. The full
* variants disable/enable preemption.
*/
-static inline struct hd_struct *get_part(struct gendisk *gendiskp,
- sector_t sector)
+static inline struct hd_struct *disk_map_sector(struct gendisk *gendiskp,
+ sector_t sector)
{
struct hd_struct *part;
int i;