Commit 327b501b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210811124428.2368491-4-hch@lst.deReviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3f74e064
...@@ -235,17 +235,6 @@ static const struct device_attribute backend_attr = { ...@@ -235,17 +235,6 @@ static const struct device_attribute backend_attr = {
.show = backend_show, .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 * Place this in the last just before the nbd is freed to
* make sure that the disk and the related kobject are also * 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) ...@@ -261,7 +250,11 @@ static void nbd_notify_destroy_completion(struct nbd_device *nbd)
static void nbd_dev_remove(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 * Remove from idr after del_gendisk() completes, so if the same ID is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment