All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
	Hou Tao <houtao1@huawei.com>
Subject: [PATCH 3/6] nbd: remove nbd_del_disk
Date: Wed, 11 Aug 2021 14:44:25 +0200	[thread overview]
Message-ID: <20210811124428.2368491-4-hch@lst.de> (raw)
In-Reply-To: <20210811124428.2368491-1-hch@lst.de>

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>
---
 drivers/block/nbd.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 6caf26b84a5b..de8b23af2486 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
-- 
2.30.2


  parent reply	other threads:[~2021-08-11 12:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 12:44 nbd locking fixups Christoph Hellwig
2021-08-11 12:44 ` [PATCH 1/6] nbd: do del_gendisk() asynchronously for NBD_DESTROY_ON_DISCONNECT Christoph Hellwig
2021-08-11 12:44 ` [PATCH 2/6] nbd: refactor device removal Christoph Hellwig
2021-08-11 12:44 ` Christoph Hellwig [this message]
2021-08-11 12:44 ` [PATCH 4/6] nbd: return the allocated nbd_device from nbd_dev_add Christoph Hellwig
2021-08-11 12:44 ` [PATCH 5/6] nbd: refactor device search and allocation in nbd_genl_connect Christoph Hellwig
2021-08-11 12:44 ` [PATCH 6/6] nbd: reduce the nbd_index_mutex scope Christoph Hellwig
2021-08-11 15:57   ` Eric Blake
2021-08-13 14:47   ` Josef Bacik
2021-08-13 14:47 ` nbd locking fixups Josef Bacik
2021-08-13 19:32 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811124428.2368491-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=houtao1@huawei.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nbd@other.debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.