f2fs: change type for 'sbi->readdir_ra'
authorYuwei Guan <ssawgyw@gmail.com>
Tue, 15 Nov 2022 06:35:37 +0000 (14:35 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 28 Nov 2022 20:46:33 +0000 (12:46 -0800)
Before this patch, the varibale 'readdir_ra' takes effect if it's equal
to '1' or not, so we can change type for it from 'int' to 'bool'.

Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/super.c
fs/f2fs/sysfs.c

index 030b7fd4142ffbfee8858fd40a7909a5470af39b..8e025157f35c9550885b5d9c7eb8506871f560bb 100644 (file)
@@ -1010,7 +1010,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d,
        struct fscrypt_str de_name = FSTR_INIT(NULL, 0);
        struct f2fs_sb_info *sbi = F2FS_I_SB(d->inode);
        struct blk_plug plug;
-       bool readdir_ra = sbi->readdir_ra == 1;
+       bool readdir_ra = sbi->readdir_ra;
        bool found_valid_dirent = false;
        int err = 0;
 
index b89b5d755ce050bb031921a0e42cc5af242094d1..96bd3461c0bbbda7a515661b90533b42fdce4b20 100644 (file)
@@ -1698,7 +1698,7 @@ struct f2fs_sb_info {
        unsigned int total_node_count;          /* total node block count */
        unsigned int total_valid_node_count;    /* valid node block count */
        int dir_level;                          /* directory level */
-       int readdir_ra;                         /* readahead inode in readdir */
+       bool readdir_ra;                        /* readahead inode in readdir */
        u64 max_io_bytes;                       /* max io bytes to merge IOs */
 
        block_t user_block_count;               /* # of user blocks */
index 05101cd4140b4338087344ea91ac738af3faf838..31435c8645c83712ca8c61aba07f47dff0831c5b 100644 (file)
@@ -4085,7 +4085,7 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
                                        1 << F2FS_IPU_HONOR_OPU_WRITE;
        }
 
-       sbi->readdir_ra = 1;
+       sbi->readdir_ra = true;
 }
 
 static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
index 97bf0dbb0974b2c6510b915ecc15b6acb130fb31..33ec467b37725bbbf4c76989b99db7da6bbe4d99 100644 (file)
@@ -656,6 +656,11 @@ out:
                return count;
        }
 
+       if (!strcmp(a->attr.name, "readdir_ra")) {
+               sbi->readdir_ra = !!t;
+               return count;
+       }
+
        *ui = (unsigned int)t;
 
        return count;