Skip to contentSkip to conversation

f2fs: change value of recovery to bool

PATCH In review Yangtao Li 2 participants 2 messages Aug 16, 2021 – Aug 17, 2021 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 f2fs: change value of recovery to bool

Recovery has only two values, 0 and 1, let's change it to bool type.

---
 fs/f2fs/super.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/f2fs/super.c +6 -5
index 8fecd3050ccd..98727e04d271 100644
@@ -3541,7 +3541,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
  */
 static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			struct f2fs_super_block **raw_super,
-			int *valid_super_block, int *recovery)
+			int *valid_super_block, bool *recovery)
 {
 	struct super_block *sb = sbi->sb;
 	int block;
@@ -3559,7 +3559,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			f2fs_err(sbi, "Unable to read %dth superblock",
 				 block + 1);
 			err = -EIO;
-			*recovery = 1;
+			*recovery = true;
 			continue;
 		}
 
@@ -3569,7 +3569,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock",
 				 block + 1);
 			brelse(bh);
-			*recovery = 1;
+			*recovery = true;
 			continue;
 		}
 
@@ -3784,15 +3784,16 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	int err;
 	bool skip_recovery = false, need_fsck = false;
 	char *options = NULL;
-	int recovery, i, valid_super_block;
+	int i, valid_super_block;
 	struct curseg_info *seg_i;
 	int retry_cnt = 1;
+	bool recovery;
 
 try_onemore:
 	err = -EINVAL;
 	raw_super = NULL;
 	valid_super_block = -1;
-	recovery = 0;
+	recovery = false;
 
 	/* allocate memory for f2fs-specific super block info */
 	sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
Signature · 1 line
2.32.0
maintainer
#1 lore raw

Hmm, I don't see a great benefit of this patch. Do we have a chance to use integer to get more specifics of the recovery reason in future?

Quoted 59 lines · Yangtao Li

Recovery has only two values, 0 and 1, let's change it to bool type.

---
 fs/f2fs/super.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/f2fs/super.c +6 -5
index 8fecd3050ccd..98727e04d271 100644
@@ -3541,7 +3541,7 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, int devi)
  */
 static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			struct f2fs_super_block **raw_super,
-			int *valid_super_block, int *recovery)
+			int *valid_super_block, bool *recovery)
 {
 	struct super_block *sb = sbi->sb;
 	int block;
@@ -3559,7 +3559,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			f2fs_err(sbi, "Unable to read %dth superblock",
 				 block + 1);
 			err = -EIO;
-			*recovery = 1;
+			*recovery = true;
 			continue;
 		}
 
@@ -3569,7 +3569,7 @@ static int read_raw_super_block(struct f2fs_sb_info *sbi,
 			f2fs_err(sbi, "Can't find valid F2FS filesystem in %dth superblock",
 				 block + 1);
 			brelse(bh);
-			*recovery = 1;
+			*recovery = true;
 			continue;
 		}
 
@@ -3784,15 +3784,16 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	int err;
 	bool skip_recovery = false, need_fsck = false;
 	char *options = NULL;
-	int recovery, i, valid_super_block;
+	int i, valid_super_block;
 	struct curseg_info *seg_i;
 	int retry_cnt = 1;
+	bool recovery;
 
 try_onemore:
 	err = -EINVAL;
 	raw_super = NULL;
 	valid_super_block = -1;
-	recovery = 0;
+	recovery = false;
 
 	/* allocate memory for f2fs-specific super block info */
 	sbi = kzalloc(sizeof(struct f2fs_sb_info), GFP_KERNEL);
Signature · 1 line
2.32.0