aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:47:22 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:06 -0400
commitbcce3de1be61e424deef35d1e86e86a35c4b6e65 (patch)
treecfdefb52bc37c61dfac160951a9beb86d5cd9ba0 /include/linux/genhd.h
parentc9959059161ddd7bf4670cf47367033d6b2f79c4 (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.h13
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
115struct gendisk { 115struct 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
168static inline int disk_max_parts(struct gendisk *disk) 170static 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
173static inline dev_t disk_devt(struct gendisk *disk) 175static 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
559extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
560extern void blk_free_devt(dev_t devt);
557extern dev_t blk_lookup_devt(const char *name, int partno); 561extern dev_t blk_lookup_devt(const char *name, int partno);
558extern char *disk_name (struct gendisk *hd, int partno, char *buf); 562extern char *disk_name (struct gendisk *hd, int partno, char *buf);
559 563
@@ -564,6 +568,9 @@ extern void printk_all_partitions(void);
564 568
565extern struct gendisk *alloc_disk_node(int minors, int node_id); 569extern struct gendisk *alloc_disk_node(int minors, int node_id);
566extern struct gendisk *alloc_disk(int minors); 570extern struct gendisk *alloc_disk(int minors);
571extern struct gendisk *alloc_disk_ext_node(int minors, int ext_minrs,
572 int node_id);
573extern struct gendisk *alloc_disk_ext(int minors, int ext_minors);
567extern struct kobject *get_disk(struct gendisk *disk); 574extern struct kobject *get_disk(struct gendisk *disk);
568extern void put_disk(struct gendisk *disk); 575extern void put_disk(struct gendisk *disk);
569extern void blk_register_region(dev_t devt, unsigned long range, 576extern void blk_register_region(dev_t devt, unsigned long range,