block: replace @ext_minors with GENHD_FL_EXT_DEVT
With previous changes, it's meaningless to limit the number of partitions. Replace @ext_minors with GENHD_FL_EXT_DEVT such that setting the flag allows the disk to have maximum number of allowed partitions (only limited by the number of entries in parsed_partitions as determined by MAX_PART constant). This kills not-too-pretty alloc_disk_ext[_node]() functions and makes @minors parameter to alloc_disk[_node]() unnecessary. The parameter is left alone to avoid disturbing the users. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
@@ -58,6 +58,8 @@ enum {
|
||||
UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
|
||||
};
|
||||
|
||||
#define DISK_MAX_PARTS 256
|
||||
|
||||
#include <linux/major.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/smp.h>
|
||||
@@ -112,6 +114,7 @@ struct hd_struct {
|
||||
#define GENHD_FL_CD 8
|
||||
#define GENHD_FL_UP 16
|
||||
#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
|
||||
#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
|
||||
|
||||
#define BLK_SCSI_MAX_CMDS (256)
|
||||
#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
|
||||
@@ -129,15 +132,13 @@ struct disk_part_tbl {
|
||||
};
|
||||
|
||||
struct gendisk {
|
||||
/* major, first_minor, minors and ext_minors are input
|
||||
* parameters only, don't use directly. Use disk_devt() and
|
||||
* disk_max_parts().
|
||||
/* major, first_minor and minors are input parameters only,
|
||||
* don't use directly. Use disk_devt() and disk_max_parts().
|
||||
*/
|
||||
int major; /* major number of driver */
|
||||
int first_minor;
|
||||
int minors; /* maximum number of minors, =1 for
|
||||
* disks that can't be partitioned. */
|
||||
int ext_minors; /* number of extended dynamic minors */
|
||||
|
||||
char disk_name[32]; /* name of major driver */
|
||||
|
||||
@@ -180,7 +181,9 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
|
||||
|
||||
static inline int disk_max_parts(struct gendisk *disk)
|
||||
{
|
||||
return disk->minors + disk->ext_minors;
|
||||
if (disk->flags & GENHD_FL_EXT_DEVT)
|
||||
return DISK_MAX_PARTS;
|
||||
return disk->minors;
|
||||
}
|
||||
|
||||
static inline bool disk_partitionable(struct gendisk *disk)
|
||||
@@ -527,9 +530,6 @@ extern void printk_all_partitions(void);
|
||||
|
||||
extern struct gendisk *alloc_disk_node(int minors, int node_id);
|
||||
extern struct gendisk *alloc_disk(int minors);
|
||||
extern struct gendisk *alloc_disk_ext_node(int minors, int ext_minrs,
|
||||
int node_id);
|
||||
extern struct gendisk *alloc_disk_ext(int minors, int ext_minors);
|
||||
extern struct kobject *get_disk(struct gendisk *disk);
|
||||
extern void put_disk(struct gendisk *disk);
|
||||
extern void blk_register_region(dev_t devt, unsigned long range,
|
||||
|
Reference in New Issue
Block a user