Skip to content

Commit

Permalink
ext4: code cleanup in mb_find_buddy()
Browse files Browse the repository at this point in the history
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 <bosong.ly@taobao.com>
Cc: Alex Tomas <alex@clusterfs.com>
Cc: Theodore Tso <tytso@google.com>
  • Loading branch information
Coly Li authored and Theodore Ts'o committed Feb 24, 2011
1 parent ea66333 commit 84b775a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,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];
Expand Down

0 comments on commit 84b775a

Please sign in to comment.