diff options
author | Christoph Hellwig <hch@lst.de> | 2023-06-08 13:02:44 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-06-12 08:04:04 -0600 |
commit | 3f0b3e785e8b54a40c530fa77b7ab37bec925c57 (patch) | |
tree | 94db68e2f6bd9e2f9270bbdd2481c8f43f64a8f1 /fs/nilfs2/super.c | |
parent | 2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307 (diff) |
block: add a sb_open_mode helper
Add a helper to return the open flags for blkdev_get_by* for passed in
super block flags instead of open coding the logic in many places.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Link: https://lore.kernel.org/r/20230608110258.189493-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r-- | fs/nilfs2/super.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 61d5e79a5e81..a41fd84d4e28 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -1278,14 +1278,11 @@ nilfs_mount(struct file_system_type *fs_type, int flags, { struct nilfs_super_data sd; struct super_block *s; - fmode_t mode = FMODE_READ; struct dentry *root_dentry; int err, s_new = false; - if (!(flags & SB_RDONLY)) - mode |= FMODE_WRITE; - - sd.bdev = blkdev_get_by_path(dev_name, mode, fs_type, NULL); + sd.bdev = blkdev_get_by_path(dev_name, sb_open_mode(flags), fs_type, + NULL); if (IS_ERR(sd.bdev)) return ERR_CAST(sd.bdev); |