summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXie Yongji <xieyongji@bytedance.com>2021-09-22 20:37:09 +0800
committerJens Axboe <axboe@kernel.dk>2021-10-21 10:12:41 -0600
commite515be8f3b3e63be4c5e91dc6620483ed0990a0c (patch)
tree3edbf3f5d2e18b2ab22cfdcc95e519156657457e
parentf059a1d2e23a165bf86e33673c6a7535a08c6341 (diff)
loop: Use invalidate_disk() helper to invalidate gendisk
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> Link: https://lore.kernel.org/r/20210922123711.187-3-xieyongji@bytedance.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/loop.c6
1 files changed, 1 insertions, 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 */