linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xie Yongji <xieyongji@bytedance.com>
To: axboe@kernel.dk, josef@toxicpanda.com, hch@infradead.org
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
	yixingchen@bytedance.com
Subject: [PATCH v2 2/4] loop: Use invalidate_disk() helper to invalidate gendisk
Date: Wed, 22 Sep 2021 20:37:09 +0800	[thread overview]
Message-ID: <20210922123711.187-3-xieyongji@bytedance.com> (raw)
In-Reply-To: <20210922123711.187-1-xieyongji@bytedance.com>

Use invalidate_disk() helper to simplify the code for gendisk
invalidation.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 7bf4686af774..eab6906326cc 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1395,11 +1395,7 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
 	blk_queue_logical_block_size(lo->lo_queue, 512);
 	blk_queue_physical_block_size(lo->lo_queue, 512);
 	blk_queue_io_min(lo->lo_queue, 512);
-	if (bdev) {
-		invalidate_bdev(bdev);
-		bdev->bd_inode->i_mapping->wb_err = 0;
-	}
-	set_capacity(lo->lo_disk, 0);
+	invalidate_disk(lo->lo_disk);
 	loop_sysfs_exit(lo);
 	if (bdev) {
 		/* let user-space know about this change */
-- 
2.11.0


  parent reply	other threads:[~2021-09-22 12:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 12:37 [PATCH v2 0/4] Add invalidate_disk() helper for drivers to invalidate the gendisk Xie Yongji
2021-09-22 12:37 ` [PATCH v2 1/4] block: Add invalidate_disk() helper " Xie Yongji
2021-09-22 14:41   ` Christoph Hellwig
2021-09-22 12:37 ` Xie Yongji [this message]
2021-09-22 12:37 ` [PATCH v2 3/4] loop: Remove the unnecessary bdev checks and unused bdev variable Xie Yongji
2021-09-22 14:43   ` Christoph Hellwig
2021-09-22 12:37 ` [PATCH v2 4/4] nbd: Use invalidate_disk() helper on disconnect Xie Yongji
2021-09-22 14:47   ` Christoph Hellwig
2021-10-21  3:41 ` [PATCH v2 0/4] Add invalidate_disk() helper for drivers to invalidate the gendisk Yongji Xie
2021-10-21 16:12 ` 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=20210922123711.187-3-xieyongji@bytedance.com \
    --to=xieyongji@bytedance.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=yixingchen@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).