fs: remove sb->s_mode
authorChristoph Hellwig <hch@lst.de>
Thu, 8 Jun 2023 11:02:45 +0000 (13:02 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Jun 2023 14:04:04 +0000 (08:04 -0600)
There is no real need to store the open mode in the super_block now.
It is only used by f2fs, which can easily recalculate it.

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-18-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/f2fs/super.c
fs/nilfs2/super.c
fs/super.c
include/linux/fs.h

index a5adb1d..5a764fe 100644 (file)
@@ -3993,6 +3993,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
        struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
        unsigned int max_devices = MAX_DEVICES;
        unsigned int logical_blksize;
+       fmode_t mode = sb_open_mode(sbi->sb->s_flags);
        int i;
 
        /* Initialize single device information */
@@ -4024,8 +4025,8 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
                if (max_devices == 1) {
                        /* Single zoned block device mount */
                        FDEV(0).bdev =
-                               blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev,
-                                       sbi->sb->s_mode, sbi->sb->s_type, NULL);
+                               blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode,
+                                                 sbi->sb->s_type, NULL);
                } else {
                        /* Multi-device mount */
                        memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN);
@@ -4043,8 +4044,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
                                        (FDEV(i).total_segments <<
                                        sbi->log_blocks_per_seg) - 1;
                        }
-                       FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path,
-                                       sbi->sb->s_mode, sbi->sb->s_type, NULL);
+                       FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode,
+                                                         sbi->sb->s_type,
+                                                         NULL);
                }
                if (IS_ERR(FDEV(i).bdev))
                        return PTR_ERR(FDEV(i).bdev);
index a41fd84..15a5a10 100644 (file)
@@ -1316,7 +1316,6 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
                s_new = true;
 
                /* New superblock instance created */
-               s->s_mode = mode;
                snprintf(s->s_id, sizeof(s->s_id), "%pg", sd.bdev);
                sb_set_blocksize(s, block_size(sd.bdev));
 
index dc7f328..86f40f8 100644 (file)
@@ -1308,7 +1308,6 @@ int get_tree_bdev(struct fs_context *fc,
                blkdev_put(bdev, fc->fs_type);
                down_write(&s->s_umount);
        } else {
-               s->s_mode = mode;
                snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
                shrinker_debugfs_rename(&s->s_shrink, "sb-%s:%s",
                                        fc->fs_type->name, s->s_id);
@@ -1382,7 +1381,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
                blkdev_put(bdev, fs_type);
                down_write(&s->s_umount);
        } else {
-               s->s_mode = mode;
                snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
                shrinker_debugfs_rename(&s->s_shrink, "sb-%s:%s",
                                        fs_type->name, s->s_id);
index 7b20536..ad1d2c9 100644 (file)
@@ -1215,7 +1215,6 @@ struct super_block {
        uuid_t                  s_uuid;         /* UUID */
 
        unsigned int            s_max_links;
-       fmode_t                 s_mode;
 
        /*
         * The next field is for VFS *only*. No filesystems have any business