public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org
Subject: [PATCH 2/2] block: remove the bdgrab in blk_drop_partitions
Date: Thu,  1 Jul 2021 10:16:38 +0200	[thread overview]
Message-ID: <20210701081638.246552-3-hch@lst.de> (raw)
In-Reply-To: <20210701081638.246552-1-hch@lst.de>

There is no need to hold a bdev reference when removing the partition.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/partitions/core.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 347c56a51d87..3907cebd2be9 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -537,12 +537,8 @@ void blk_drop_partitions(struct gendisk *disk)
 
 	lockdep_assert_held(&disk->open_mutex);
 
-	xa_for_each_start(&disk->part_tbl, idx, part, 1) {
-		if (!bdgrab(part))
-			continue;
+	xa_for_each_start(&disk->part_tbl, idx, part, 1)
 		delete_partition(part);
-		bdput(part);
-	}
 }
 
 static bool blk_add_partition(struct gendisk *disk,
-- 
2.30.2


  parent reply	other threads:[~2021-07-01  8:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  8:16 two fixup for the block_device / hd_struct merge Christoph Hellwig
2021-07-01  8:16 ` [PATCH 1/2] block: grab a device refcount in disk_uevent Christoph Hellwig
2021-07-01  8:54   ` Ming Lei
2021-07-01  9:02     ` Christoph Hellwig
2021-07-01  9:17       ` Ming Lei
2021-07-01  9:27         ` Ming Lei
2021-07-01  9:49           ` Christoph Hellwig
2021-07-01  8:16 ` Christoph Hellwig [this message]
2021-07-01 16:21 ` two fixup for the block_device / hd_struct merge 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=20210701081638.246552-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox