diff options
author | Christoph Hellwig <hch@lst.de> | 2020-11-25 21:20:08 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-01 22:53:39 +0100 |
commit | 37c3fc9abb25cd767ad5b048358336ac89488c16 (patch) | |
tree | 50d6c3ef1c865a76931fb83976b42e4a7e12cd02 /drivers/block/loop.c | |
parent | block: remove ->bd_contains (diff) | |
download | linux-37c3fc9abb25cd767ad5b048358336ac89488c16.tar.xz linux-37c3fc9abb25cd767ad5b048358336ac89488c16.zip |
block: simplify the block device claiming interface
Stop passing the whole device as a separate argument given that it
can be trivially deducted and cleanup the !holder debug check.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c0df88b3300c..d643c67be6ac 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1069,7 +1069,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, struct file *file; struct inode *inode; struct address_space *mapping; - struct block_device *claimed_bdev = NULL; int error; loff_t size; bool partscan; @@ -1088,8 +1087,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, * here to avoid changing device under exclusive owner. */ if (!(mode & FMODE_EXCL)) { - claimed_bdev = bdev_whole(bdev); - error = bd_prepare_to_claim(bdev, claimed_bdev, loop_configure); + error = bd_prepare_to_claim(bdev, loop_configure); if (error) goto out_putf; } @@ -1176,15 +1174,15 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, mutex_unlock(&loop_ctl_mutex); if (partscan) loop_reread_partitions(lo, bdev); - if (claimed_bdev) - bd_abort_claiming(bdev, claimed_bdev, loop_configure); + if (!(mode & FMODE_EXCL)) + bd_abort_claiming(bdev, loop_configure); return 0; out_unlock: mutex_unlock(&loop_ctl_mutex); out_bdev: - if (claimed_bdev) - bd_abort_claiming(bdev, claimed_bdev, loop_configure); + if (!(mode & FMODE_EXCL)) + bd_abort_claiming(bdev, loop_configure); out_putf: fput(file); out: |