mballoc: code cleanup in mb_find_buddy()
PATCH 1/5 mballoc: code cleanup in mb_find_buddy()
Current code calculate max no matter whether order is zero, it's unnecessary. This cleanup patch sets max to "1 << (e4b->bd_blkbits
+ 3)" only when order == 0.
Signed-off-by Coly Li <[email protected]>
Cc Alex Tomas <[email protected]>
Cc Theodore Tso <[email protected]>
--- fs/ext4/mballoc.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +3 -2
@@ -427,9 +427,10 @@ static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) }/* at order 0 we see each particular block */ - *max =1 << (e4b->bd_blkbits +3 ); -if (order ==0 ) +if (order ==0 ) { + *max =1 << (e4b->bd_blkbits +3 );return EXT4_MB_BITMAP (e4b); + } bb =EXT4_MB_BUDDY (e4b) +EXT4_SB (e4b->bd_sb)->s_mb_offsets[order]; *max =EXT4_SB (e4b->bd_sb)->s_mb_maxs[order];
Signature · 1 line
1.7.3.4
Ted Ts'o
maintainerQuoted 7 lines · Coly Li
Current code calculate max no matter whether order is zero, it's unnecessary. This cleanup patch sets max to "1 << (
e4b->bd_blkbits
+ 3)" only when order == 0.Signed-off-by Coly Li <[email protected]>Cc Alex Tomas <[email protected]>Cc Theodore Tso <[email protected]>
Added to the ext4 patch queue, thanks!
- Ted