diff options
author | Tejun Heo <tj@kernel.org> | 2008-08-25 06:47:22 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:06 -0400 |
commit | bcce3de1be61e424deef35d1e86e86a35c4b6e65 (patch) | |
tree | cfdefb52bc37c61dfac160951a9beb86d5cd9ba0 /include/linux/genhd.h | |
parent | c9959059161ddd7bf4670cf47367033d6b2f79c4 (diff) |
block: implement extended dev numbers
Implement extended device numbers. A block driver can tell block
layer that it wants to use extended device numbers. After the usual
minor space is used up, block layer automatically allocates devt's
from EXT_BLOCK_MAJOR.
Currently only one major number is allocated for this but as the
allocation is strictly on-demand, ~1mil minor space under it should
suffice unless the system actually has more than ~1mil partitions and
if that ever happens adding more majors to the extended devt area is
easy.
Due to internal implementation issues, the first partition can't be
allocated on the extended area. In other words, genhd->minors should
at least be 1. This limitation will be lifted by later changes.
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 ac8a901f2002..6fc532424062 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -113,13 +113,15 @@ struct hd_struct { | |||
113 | #define GENHD_FL_FAIL 64 | 113 | #define GENHD_FL_FAIL 64 |
114 | 114 | ||
115 | struct gendisk { | 115 | struct gendisk { |
116 | /* major, first_minor and minors are input parameters only, | 116 | /* major, first_minor, minors and ext_minors are input |
117 | * don't use directly. Use disk_devt() and disk_max_parts(). | 117 | * parameters only, don't use directly. Use disk_devt() and |
118 | * disk_max_parts(). | ||
118 | */ | 119 | */ |
119 | int major; /* major number of driver */ | 120 | int major; /* major number of driver */ |
120 | int first_minor; | 121 | int first_minor; |
121 | int minors; /* maximum number of minors, =1 for | 122 | int minors; /* maximum number of minors, =1 for |
122 | * disks that can't be partitioned. */ | 123 | * disks that can't be partitioned. */ |
124 | int ext_minors; /* number of extended dynamic minors */ | ||
123 | 125 | ||
124 | char disk_name[32]; /* name of major driver */ | 126 | char disk_name[32]; /* name of major driver */ |
125 | 127 | ||
@@ -167,7 +169,7 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part) | |||
167 | 169 | ||
168 | static inline int disk_max_parts(struct gendisk *disk) | 170 | static inline int disk_max_parts(struct gendisk *disk) |
169 | { | 171 | { |
170 | return disk->minors - 1; | 172 | return disk->minors + disk->ext_minors - 1; |
171 | } | 173 | } |
172 | 174 | ||
173 | static inline dev_t disk_devt(struct gendisk *disk) | 175 | static inline dev_t disk_devt(struct gendisk *disk) |
@@ -554,6 +556,8 @@ struct unixware_disklabel { | |||
554 | #define ADDPART_FLAG_RAID 1 | 556 | #define ADDPART_FLAG_RAID 1 |
555 | #define ADDPART_FLAG_WHOLEDISK 2 | 557 | #define ADDPART_FLAG_WHOLEDISK 2 |
556 | 558 | ||
559 | extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); | ||
560 | extern void blk_free_devt(dev_t devt); | ||
557 | extern dev_t blk_lookup_devt(const char *name, int partno); | 561 | extern dev_t blk_lookup_devt(const char *name, int partno); |
558 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); | 562 | extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
559 | 563 | ||
@@ -564,6 +568,9 @@ extern void printk_all_partitions(void); | |||
564 | 568 | ||
565 | extern struct gendisk *alloc_disk_node(int minors, int node_id); | 569 | extern struct gendisk *alloc_disk_node(int minors, int node_id); |
566 | extern struct gendisk *alloc_disk(int minors); | 570 | extern struct gendisk *alloc_disk(int minors); |
571 | extern struct gendisk *alloc_disk_ext_node(int minors, int ext_minrs, | ||
572 | int node_id); | ||
573 | extern struct gendisk *alloc_disk_ext(int minors, int ext_minors); | ||
567 | extern struct kobject *get_disk(struct gendisk *disk); | 574 | extern struct kobject *get_disk(struct gendisk *disk); |
568 | extern void put_disk(struct gendisk *disk); | 575 | extern void put_disk(struct gendisk *disk); |
569 | extern void blk_register_region(dev_t devt, unsigned long range, | 576 | extern void blk_register_region(dev_t devt, unsigned long range, |