Skip to content

Commit a58bd76

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove the minors argument to __alloc_disk_node
This was a leftover from the legacy alloc_disk interface. Switch the scsi ULPs and dasd to set ->minors directly like all other drivers and remove the argument. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Stefan Haberland <[email protected]> [dasd] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9c2b9db commit a58bd76

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

block/blk-mq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3143,7 +3143,7 @@ struct gendisk *__blk_mq_alloc_disk(struct blk_mq_tag_set *set, void *queuedata,
31433143
if (IS_ERR(q))
31443144
return ERR_CAST(q);
31453145

3146-
disk = __alloc_disk_node(0, set->numa_node, lkclass);
3146+
disk = __alloc_disk_node(set->numa_node, lkclass);
31473147
if (!disk) {
31483148
blk_cleanup_queue(q);
31493149
return ERR_PTR(-ENOMEM);

block/genhd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,7 @@ dev_t blk_lookup_devt(const char *name, int partno)
12541254
return devt;
12551255
}
12561256

1257-
struct gendisk *__alloc_disk_node(int minors, int node_id,
1258-
struct lock_class_key *lkclass)
1257+
struct gendisk *__alloc_disk_node(int node_id, struct lock_class_key *lkclass)
12591258
{
12601259
struct gendisk *disk;
12611260

@@ -1277,7 +1276,6 @@ struct gendisk *__alloc_disk_node(int minors, int node_id,
12771276
if (xa_insert(&disk->part_tbl, 0, disk->part0, GFP_KERNEL))
12781277
goto out_destroy_part_tbl;
12791278

1280-
disk->minors = minors;
12811279
rand_initialize_disk(disk);
12821280
disk_to_dev(disk)->class = &block_class;
12831281
disk_to_dev(disk)->type = &disk_type;
@@ -1309,7 +1307,7 @@ struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass)
13091307
if (!q)
13101308
return NULL;
13111309

1312-
disk = __alloc_disk_node(0, node, lkclass);
1310+
disk = __alloc_disk_node(node, lkclass);
13131311
if (!disk) {
13141312
blk_cleanup_queue(q);
13151313
return NULL;

drivers/s390/block/dasd_genhd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ int dasd_gendisk_alloc(struct dasd_block *block)
4040
if (base->devindex >= DASD_PER_MAJOR)
4141
return -EBUSY;
4242

43-
gdp = __alloc_disk_node(1 << DASD_PARTN_BITS, NUMA_NO_NODE,
44-
&dasd_bio_compl_lkclass);
43+
gdp = __alloc_disk_node(NUMA_NO_NODE, &dasd_bio_compl_lkclass);
4544
if (!gdp)
4645
return -ENOMEM;
4746

4847
/* Initialize gendisk structure. */
4948
gdp->major = DASD_MAJOR;
5049
gdp->first_minor = base->devindex << DASD_PARTN_BITS;
50+
gdp->minors = 1 << DASD_PARTN_BITS;
5151
gdp->fops = &dasd_device_operations;
5252

5353
/*

drivers/scsi/sd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3409,7 +3409,7 @@ static int sd_probe(struct device *dev)
34093409
if (!sdkp)
34103410
goto out;
34113411

3412-
gd = __alloc_disk_node(SD_MINORS, NUMA_NO_NODE, &sd_bio_compl_lkclass);
3412+
gd = __alloc_disk_node(NUMA_NO_NODE, &sd_bio_compl_lkclass);
34133413
if (!gd)
34143414
goto out_free;
34153415

@@ -3455,6 +3455,7 @@ static int sd_probe(struct device *dev)
34553455

34563456
gd->major = sd_major((index & 0xf0) >> 4);
34573457
gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
3458+
gd->minors = SD_MINORS;
34583459

34593460
gd->fops = &sd_fops;
34603461
gd->private_data = &sdkp->driver;

drivers/scsi/sr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static int sr_probe(struct device *dev)
714714

715715
kref_init(&cd->kref);
716716

717-
disk = __alloc_disk_node(1, NUMA_NO_NODE, &sr_bio_compl_lkclass);
717+
disk = __alloc_disk_node(NUMA_NO_NODE, &sr_bio_compl_lkclass);
718718
if (!disk)
719719
goto fail_free;
720720
mutex_init(&cd->lock);
@@ -731,6 +731,7 @@ static int sr_probe(struct device *dev)
731731

732732
disk->major = SCSI_CDROM_MAJOR;
733733
disk->first_minor = minor;
734+
disk->minors = 1;
734735
sprintf(disk->disk_name, "sr%d", minor);
735736
disk->fops = &sr_bdops;
736737
disk->flags = GENHD_FL_CD | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE;

include/linux/genhd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ static inline sector_t get_capacity(struct gendisk *disk)
259259
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
260260
void blk_drop_partitions(struct gendisk *disk);
261261

262-
struct gendisk *__alloc_disk_node(int minors, int node_id,
263-
struct lock_class_key *lkclass);
262+
struct gendisk *__alloc_disk_node(int node_id, struct lock_class_key *lkclass);
264263
extern void put_disk(struct gendisk *disk);
265264
struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass);
266265

0 commit comments

Comments
 (0)