ext4: fix log printing of ext4_mb_regular_allocator()
PATCH v3 1/1 ext4: fix log printing of ext4_mb_regular_allocator()
Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.
V3:
It may be better to add a comma between start and len, which is convenient for script processing.
V2:
Add more valuable information, such as group, start, len, lost.
--- fs/ext4/mballoc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ext4/mballoc.c +6 -3
@@ -2218,6 +2218,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,struct ext4_sb_info *sbi;struct super_block *sb;struct ext4_buddy e4b; +unsigned int lost; sb = ac->ac_sb; sbi =EXT4_SB (sb);
@@ -2341,22 +2342,24 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,* We've been searching too long. Let's try to allocate * the best chunk we've found so far */ -ext4_mb_try_best_found (ac, &e4b);if (ac->ac_status !=AC_STATUS_FOUND ) {/* * Someone more lucky has already allocated it. * The only thing we can do is just take first * found block(s) -printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n"); */ + lost = (unsigned int )atomic_inc_return (&sbi->s_mb_lost_chunks); +mb_debug (sb,"lost chunk, group: %u, start: %d, len: %d, lost: %u\n" , + ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start, + ac->ac_b_ex.fe_len, lost); + ac->ac_b_ex.fe_group =0 ; ac->ac_b_ex.fe_start =0 ; ac->ac_b_ex.fe_len =0 ; ac->ac_status =AC_STATUS_CONTINUE ; ac->ac_flags |=EXT4_MB_HINT_FIRST ; cr =3 ; -atomic_inc (&sbi->s_mb_lost_chunks); goto repeat; } }
Signature · 1 line
1.8.3.1
Quoted 4 lines · brookxu
Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.
Quoted 8 lines
V3:
It may be better to add a comma between start and len, which is convenient for script processing.V2:
Add more valuable information, such as group, start, len, lost.Signed-off-by Chunguang Xu <[email protected]>
A very minor cleanup possible, but not really worthwhile to resubmit if Ted wants to apply it. Either way, it looks good.
Quoted 20 lines
---
fs/ext4/mballoc.c| 9 ++++++---1 file changed, 6 insertions(+), 3 deletions(-)fs/ext4/mballoc.c +1
-0@@ -2218,6 +2218,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,struct ext4_sb_info *sbi;struct super_block *sb;struct ext4_buddy e4b; +unsigned int lost; sb = ac->ac_sb; sbi =EXT4_SB (sb);@@ -2341,22 +2342,24 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,* We've been searching too long. Let's try to allocate * the best chunk we've found so far */
fs/ext4/mballoc.c static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac, · line 2352
Quoted 10 lines
fs/ext4/mballoc.c +1
-2-ext4_mb_try_best_found (ac, &e4b);if (ac->ac_status !=AC_STATUS_FOUND ) {/* * Someone more lucky has already allocated it. * The only thing we can do is just take first * found block(s) -printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n"); */ + lost = (unsigned int )atomic_inc_return (&sbi->s_mb_lost_chunks);
(minor) no need for a typecast here? The return type is already "int", so it would be better to declare "int lost" and that would make the line a bit shorter.
Quoted 15 lines
fs/ext4/mballoc.c +4
-2+mb_debug (sb,"lost chunk, group: %u, start: %d, len: %d, lost: %u\n" , + ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start, + ac->ac_b_ex.fe_len, lost); + ac->ac_b_ex.fe_group =0 ; ac->ac_b_ex.fe_start =0 ; ac->ac_b_ex.fe_len =0 ; ac->ac_status =AC_STATUS_CONTINUE ; ac->ac_flags |=EXT4_MB_HINT_FIRST ; cr =3 ; -atomic_inc (&sbi->s_mb_lost_chunks); goto repeat; } } --
Quoted 3 lines
1.8.3.1
Cheers, Andreas
Quoted 11 lines · brookxu
Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.
V3:
It may be better to add a comma between start and len, which is convenient for script processing.V2:
Add more valuable information, such as group, start, len, lost.Signed-off-by Chunguang Xu <[email protected]>
LGTM, please feel free to add:
Quoted 45 lines
--- fs/ext4/mballoc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/ext4/mballoc.c +6
-3@@ -2218,6 +2218,7 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,struct ext4_sb_info *sbi;struct super_block *sb;struct ext4_buddy e4b; +unsigned int lost; sb = ac->ac_sb; sbi =EXT4_SB (sb);@@ -2341,22 +2342,24 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,* We've been searching too long. Let's try to allocate * the best chunk we've found so far */ -ext4_mb_try_best_found (ac, &e4b);if (ac->ac_status !=AC_STATUS_FOUND ) {/* * Someone more lucky has already allocated it. * The only thing we can do is just take first * found block(s) -printk(KERN_DEBUG "EXT4-fs: someone won our chunk\n"); */ + lost = (unsigned int )atomic_inc_return (&sbi->s_mb_lost_chunks); +mb_debug (sb,"lost chunk, group: %u, start: %d, len: %d, lost: %u\n" , + ac->ac_b_ex.fe_group, ac->ac_b_ex.fe_start, + ac->ac_b_ex.fe_len, lost); + ac->ac_b_ex.fe_group =0 ; ac->ac_b_ex.fe_start =0 ; ac->ac_b_ex.fe_len =0 ; ac->ac_status =AC_STATUS_CONTINUE ; ac->ac_flags |=EXT4_MB_HINT_FIRST ; cr =3 ; -atomic_inc (&sbi->s_mb_lost_chunks); goto repeat; } }
Quoted 2 lines · brookxu
Fix log printing of ext4_mb_regular_allocator(),it may be an unintentional behavior.
Thanks, applied with Andreas's suggested improvement and with a reworded commit description.
- Ted