All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Stefan Haberland <sth@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	linux-block@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [PATCH 07/10] block: don't call invalidate_partition from blk_drop_partitions
Date: Tue, 14 Apr 2020 09:28:59 +0200	[thread overview]
Message-ID: <20200414072902.324936-8-hch@lst.de> (raw)
In-Reply-To: <20200414072902.324936-1-hch@lst.de>

Given that the device must not be busy, most of the calls from
invalidate_partition that are related to file system metadata are
guranteed to not happen.  Just open code the calls to sync_blockdev
and invalidate_bdev instead.

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

diff --git a/block/partitions/core.c b/block/partitions/core.c
index 8c5295ca8ea6..a94d296d7aed 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -607,15 +607,14 @@ int blk_drop_partitions(struct block_device *bdev)
 {
 	struct disk_part_iter piter;
 	struct hd_struct *part;
-	int res;
 
 	if (!disk_part_scan_enabled(bdev->bd_disk))
 		return 0;
 	if (bdev->bd_part_count || bdev->bd_openers > 1)
 		return -EBUSY;
-	res = invalidate_partition(bdev->bd_disk, 0);
-	if (res)
-		return res;
+
+	sync_blockdev(bdev);
+	invalidate_bdev(bdev);
 
 	disk_part_iter_init(&piter, bdev->bd_disk, DISK_PITER_INCL_EMPTY);
 	while ((part = disk_part_iter_next(&piter)))
-- 
2.25.1


  parent reply	other threads:[~2020-04-14  7:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  7:28 more partition handling cleanups v2 Christoph Hellwig
2020-04-14  7:28 ` [PATCH 01/10] block: refactor blkpg_ioctl Christoph Hellwig
2020-04-14  8:09   ` Johannes Thumshirn
2020-04-14  7:28 ` [PATCH 02/10] block: pass a hd_struct to delete_partition Christoph Hellwig
2020-04-14  7:28 ` [PATCH 03/10] block: cleanup hd_struct freeing Christoph Hellwig
2020-04-14  7:28 ` [PATCH 04/10] block: remove hd_struct_kill Christoph Hellwig
2020-04-14  7:28 ` [PATCH 05/10] block: remove the disk argument from blk_drop_partitions Christoph Hellwig
2020-04-14  7:28 ` [PATCH 06/10] dasd: use blk_drop_partitions instead of badly reimplementing it Christoph Hellwig
2020-04-14  7:28 ` Christoph Hellwig [this message]
2020-04-14  8:12   ` [PATCH 07/10] block: don't call invalidate_partition from blk_drop_partitions Johannes Thumshirn
2020-04-14  7:29 ` [PATCH 08/10] block: simplify block device syncing in bdev_del_partition Christoph Hellwig
2020-04-14  7:29 ` [PATCH 09/10] block: mark invalidate_partition static Christoph Hellwig
2020-04-14  7:29 ` [PATCH 10/10] block: fold bdev_unhash_inode into invalidate_partition Christoph Hellwig
2020-04-20 17:26 ` more partition handling cleanups v2 Christoph Hellwig
2020-04-20 17:35 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2020-04-08 19:44 Christoph Hellwig
2020-04-08 19:44 ` [PATCH 07/10] block: don't call invalidate_partition from blk_drop_partitions Christoph Hellwig

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=20200414072902.324936-8-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sth@linux.ibm.com \
    /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.