Commit 25044880 authored by yangerkun's avatar yangerkun Committed by Theodore Ts'o

ext4: remove unused buddy_loaded in ext4_mb_seq_groups_show

We can just first call ext4_mb_unload_buddy, then copy information from
ext4_group_info. So remove this unused value.
Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240118042557.380058-1-yangerkun@huawei.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 2b81493f
...@@ -3015,8 +3015,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) ...@@ -3015,8 +3015,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
{ {
struct super_block *sb = pde_data(file_inode(seq->file)); struct super_block *sb = pde_data(file_inode(seq->file));
ext4_group_t group = (ext4_group_t) ((unsigned long) v); ext4_group_t group = (ext4_group_t) ((unsigned long) v);
int i; int i, err;
int err, buddy_loaded = 0;
struct ext4_buddy e4b; struct ext4_buddy e4b;
struct ext4_group_info *grinfo; struct ext4_group_info *grinfo;
unsigned char blocksize_bits = min_t(unsigned char, unsigned char blocksize_bits = min_t(unsigned char,
...@@ -3046,14 +3045,14 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) ...@@ -3046,14 +3045,14 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
seq_printf(seq, "#%-5u: I/O error\n", group); seq_printf(seq, "#%-5u: I/O error\n", group);
return 0; return 0;
} }
buddy_loaded = 1; ext4_mb_unload_buddy(&e4b);
} }
/*
* We care only about free space counters in the group info and
* these are safe to access even after the buddy has been unloaded
*/
memcpy(&sg, grinfo, i); memcpy(&sg, grinfo, i);
if (buddy_loaded)
ext4_mb_unload_buddy(&e4b);
seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free, seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free,
sg.info.bb_fragments, sg.info.bb_first_free); sg.info.bb_fragments, sg.info.bb_first_free);
for (i = 0; i <= 13; i++) for (i = 0; i <= 13; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment