Skip to contentSkip to conversation

ext2: code cleanup for descriptor_loc()

PATCH In review Chengguang Xu 2 participants 2 messages Nov 15, 2019 – Nov 19, 2019 ext2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext2: code cleanup for descriptor_loc()

Code cleanup by removing unnecessary variable
in descriptor_loc().

---
 fs/ext2/super.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ext2/super.c +1 -4
index 30c630d73f0f..bef607d5db28 100644
@@ -806,7 +806,6 @@ static unsigned long descriptor_loc(struct super_block *sb,
 {
 	struct ext2_sb_info *sbi = EXT2_SB(sb);
 	unsigned long bg, first_meta_bg;
-	int has_super = 0;
 	
 	first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
 
@@ -814,10 +813,8 @@ static unsigned long descriptor_loc(struct super_block *sb,
 	    nr < first_meta_bg)
 		return (logic_sb_block + nr + 1);
 	bg = sbi->s_desc_per_block * nr;
-	if (ext2_bg_has_super(sb, bg))
-		has_super = 1;
 
-	return ext2_group_first_block_no(sb, bg) + has_super;
+	return ext2_group_first_block_no(sb, bg) + ext2_bg_has_super(sb, bg);
 }
 
 static int ext2_fill_super(struct super_block *sb, void *data, int silent)
Signature · 1 line
2.21.0
#1 lore raw
Quoted 4 lines · Chengguang Xu

Code cleanup by removing unnecessary variable
in descriptor_loc().

Thanks! I've added the patch to my tree.

Honza

Quoted 33 lines
---
 fs/ext2/super.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ext2/super.c +1 -4
index 30c630d73f0f..bef607d5db28 100644
@@ -806,7 +806,6 @@ static unsigned long descriptor_loc(struct super_block *sb,
 {
 	struct ext2_sb_info *sbi = EXT2_SB(sb);
 	unsigned long bg, first_meta_bg;
-	int has_super = 0;
 
 	first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
 
@@ -814,10 +813,8 @@ static unsigned long descriptor_loc(struct super_block *sb,
 	    nr < first_meta_bg)
 		return (logic_sb_block + nr + 1);
 	bg = sbi->s_desc_per_block * nr;
-	if (ext2_bg_has_super(sb, bg))
-		has_super = 1;
 
-	return ext2_group_first_block_no(sb, bg) + has_super;
+	return ext2_group_first_block_no(sb, bg) + ext2_bg_has_super(sb, bg);
 }
 
 static int ext2_fill_super(struct super_block *sb, void *data, int silent)
Signature · 1 line
2.21.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR