]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
block: remove alloc_disk and alloc_disk_node
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Aug 2021 13:19:06 +0000 (15:19 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 23 Aug 2021 18:54:30 +0000 (12:54 -0600)
Most drivers should use and have been converted to use blk_alloc_disk
and blk_mq_alloc_disk.  Only the scsi ULPs and dasd still allocate
a disk separately from the request_queue, so don't bother with
convenience macros for something that should not see significant
new users and remove these wrappers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210816131910.615153-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/s390/block/dasd_genhd.c
drivers/scsi/sd.c
drivers/scsi/sr.c
include/linux/genhd.h

index 493e8469893c878bc546f4a7495781fe388d503c..07a69b19dd3187681340e82d33846a9df17abc31 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "dasd_int.h"
 
+static struct lock_class_key dasd_bio_compl_lkclass;
+
 /*
  * Allocate and register gendisk structure for device.
  */
@@ -38,7 +40,8 @@ int dasd_gendisk_alloc(struct dasd_block *block)
        if (base->devindex >= DASD_PER_MAJOR)
                return -EBUSY;
 
-       gdp = alloc_disk(1 << DASD_PARTN_BITS);
+       gdp = __alloc_disk_node(1 << DASD_PARTN_BITS, NUMA_NO_NODE,
+                               &dasd_bio_compl_lkclass);
        if (!gdp)
                return -ENOMEM;
 
index 5b5b8266e1429a83ed176986fcf405c9dcbe84ec..a9535c6484de089628cfceaa7f4865868dfd358a 100644 (file)
@@ -129,6 +129,7 @@ static DEFINE_MUTEX(sd_ref_mutex);
 static struct kmem_cache *sd_cdb_cache;
 static mempool_t *sd_cdb_pool;
 static mempool_t *sd_page_pool;
+static struct lock_class_key sd_bio_compl_lkclass;
 
 static const char *sd_cache_types[] = {
        "write through", "none", "write back",
@@ -3408,7 +3409,7 @@ static int sd_probe(struct device *dev)
        if (!sdkp)
                goto out;
 
-       gd = alloc_disk(SD_MINORS);
+       gd = __alloc_disk_node(SD_MINORS, NUMA_NO_NODE, &sd_bio_compl_lkclass);
        if (!gd)
                goto out_free;
 
index 94c254e9012e3da2e73fbbe13ea51dd9a1e9bf3d..fee2bdfe6132f220df9c5acee9b222e50e9aa6f3 100644 (file)
@@ -106,6 +106,8 @@ static struct scsi_driver sr_template = {
 static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
 static DEFINE_SPINLOCK(sr_index_lock);
 
+static struct lock_class_key sr_bio_compl_lkclass;
+
 /* This semaphore is used to mediate the 0->1 reference get in the
  * face of object destruction (i.e. we can't allow a get on an
  * object after last put) */
@@ -712,7 +714,7 @@ static int sr_probe(struct device *dev)
 
        kref_init(&cd->kref);
 
-       disk = alloc_disk(1);
+       disk = __alloc_disk_node(1, NUMA_NO_NODE, &sr_bio_compl_lkclass);
        if (!disk)
                goto fail_free;
        mutex_init(&cd->lock);
index 3d2e5ee30677fc4898638061033a891ec6d8d259..ceda9b255dba2dd7a59319d6b67af62121b569bc 100644 (file)
@@ -262,16 +262,6 @@ void blk_drop_partitions(struct gendisk *disk);
 struct gendisk *__alloc_disk_node(int minors, int node_id,
                struct lock_class_key *lkclass);
 extern void put_disk(struct gendisk *disk);
-
-#define alloc_disk_node(minors, node_id)                               \
-({                                                                     \
-       static struct lock_class_key __key;                             \
-                                                                       \
-       __alloc_disk_node(minors, node_id, &__key);                     \
-})
-
-#define alloc_disk(minors) alloc_disk_node(minors, NUMA_NO_NODE)
-
 struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass);
 
 /**