summaryrefslogtreecommitdiff
path: root/drivers/block/nbd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-11 14:44:25 +0200
committerJens Axboe <axboe@kernel.dk>2021-08-13 14:17:36 -0600
commit327b501b1d94342fe17a1b6b1a40746e57ddd472 (patch)
tree30bf3a724b0e50d21c354d89b5fc4872851f5809 /drivers/block/nbd.c
parent3f74e0645c52a08f640380c9c46f9a3a172b9389 (diff)
nbd: remove nbd_del_disk
Fold nbd_del_disk and remove the pointless NULL check on ->disk given that it is always set for a successfully allocated nbd_device structure. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210811124428.2368491-4-hch@lst.de Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r--drivers/block/nbd.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a9883fbed924..48530fe01c0f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -235,17 +235,6 @@ static const struct device_attribute backend_attr = {
.show = backend_show,
};
-static void nbd_del_disk(struct nbd_device *nbd)
-{
- struct gendisk *disk = nbd->disk;
-
- if (disk) {
- del_gendisk(disk);
- blk_cleanup_disk(disk);
- blk_mq_free_tag_set(&nbd->tag_set);
- }
-}
-
/*
* Place this in the last just before the nbd is freed to
* make sure that the disk and the related kobject are also
@@ -261,7 +250,11 @@ static void nbd_notify_destroy_completion(struct nbd_device *nbd)
static void nbd_dev_remove(struct nbd_device *nbd)
{
- nbd_del_disk(nbd);
+ struct gendisk *disk = nbd->disk;
+
+ del_gendisk(disk);
+ blk_cleanup_disk(disk);
+ blk_mq_free_tag_set(&nbd->tag_set);
/*
* Remove from idr after del_gendisk() completes, so if the same ID is