diff options
author | yangerkun <yangerkun@huawei.com> | 2024-01-18 12:25:57 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2024-02-21 22:33:21 -0500 |
commit | 4b55d3431ce5ce906480f95391b7af4fecfa2d84 (patch) | |
tree | 8a0d8a925d24088e83d86f8931ccba15cb48f65f /fs/ext4/mballoc.c | |
parent | 250448802cda4f4f698ebf946b3a2d2a40423972 (diff) |
ext4: improve error msg for ext4_mb_seq_groups_show
While cat mb_groups for a mounted ext4 image which has some corrupted
group, the string return to userspace was just "I/O error" which confuse
me a lot. Improve it with ext4_decode_error.
Signed-off-by: yangerkun <yangerkun@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240118042557.380058-2-yangerkun@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index abe86791590b..1a3c738ff21a 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3016,6 +3016,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) struct super_block *sb = pde_data(file_inode(seq->file)); ext4_group_t group = (ext4_group_t) ((unsigned long) v); int i, err; + char nbuf[16]; struct ext4_buddy e4b; struct ext4_group_info *grinfo; unsigned char blocksize_bits = min_t(unsigned char, @@ -3042,7 +3043,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) { err = ext4_mb_load_buddy(sb, group, &e4b); if (err) { - seq_printf(seq, "#%-5u: I/O error\n", group); + seq_printf(seq, "#%-5u: %s\n", group, ext4_decode_error(NULL, err, nbuf)); return 0; } ext4_mb_unload_buddy(&e4b); |