summaryrefslogtreecommitdiff
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-08 14:02:43 +0300
committerJens Axboe <axboe@kernel.dk>2023-06-12 17:04:04 +0300
commit2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307 (patch)
tree756552135a5496bd16f644aad640a9e955d903b4 /fs/ext4/super.c
parent2ef789288afd365f4245ba97e56189062de5148e (diff)
downloadlinux-2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307.tar.xz
block: use the holder as indication for exclusive opens
The current interface for exclusive opens is rather confusing as it requires both the FMODE_EXCL flag and a holder. Remove the need to pass FMODE_EXCL and just key off the exclusive open off a non-NULL holder. For blkdev_put this requires adding the holder argument, which provides better debug checking that only the holder actually releases the hold, but at the same time allows removing the now superfluous mode argument. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Christian Brauner <brauner@kernel.org> Acked-by: David Sterba <dsterba@suse.com> [btrfs] Acked-by: Jack Wang <jinpu.wang@ionos.com> [rnbd] Link: https://lore.kernel.org/r/20230608110258.189493-16-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9070ea9154d7..92dd699139a3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1112,7 +1112,7 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
{
struct block_device *bdev;
- bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb,
+ bdev = blkdev_get_by_dev(dev, FMODE_READ | FMODE_WRITE, sb,
&ext4_holder_ops);
if (IS_ERR(bdev))
goto fail;
@@ -1128,17 +1128,12 @@ fail:
/*
* Release the journal device
*/
-static void ext4_blkdev_put(struct block_device *bdev)
-{
- blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
-}
-
static void ext4_blkdev_remove(struct ext4_sb_info *sbi)
{
struct block_device *bdev;
bdev = sbi->s_journal_bdev;
if (bdev) {
- ext4_blkdev_put(bdev);
+ blkdev_put(bdev, sbi->s_es);
sbi->s_journal_bdev = NULL;
}
}
@@ -5915,7 +5910,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
out_journal:
jbd2_journal_destroy(journal);
out_bdev:
- ext4_blkdev_put(bdev);
+ blkdev_put(bdev, sb);
return NULL;
}