All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] mballoc: code cleanup in mb_find_buddy()
@ 2011-02-06  4:53 Coly Li
  2011-02-24 19:06 ` Ted Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Coly Li @ 2011-02-06  4:53 UTC (permalink / raw)
  To: linux-ext4; +Cc: Alex Tomas, Theodore Tso

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>
---
  fs/ext4/mballoc.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 851f49b..d5b372c 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -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];
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/5] mballoc: code cleanup in mb_find_buddy()
  2011-02-06  4:53 [PATCH 1/5] mballoc: code cleanup in mb_find_buddy() Coly Li
@ 2011-02-24 19:06 ` Ted Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2011-02-24 19:06 UTC (permalink / raw)
  To: Coly Li; +Cc: linux-ext4, Alex Tomas, Theodore Tso

On Sun, Feb 06, 2011 at 12:53:44PM +0800, Coly Li wrote:
> 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>

Added to the ext4 patch queue, thanks!

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-24 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-06  4:53 [PATCH 1/5] mballoc: code cleanup in mb_find_buddy() Coly Li
2011-02-24 19:06 ` Ted Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.