lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 06 Feb 2011 12:53:44 +0800
From:	Coly Li <i@...y.li>
To:	linux-ext4@...r.kernel.org
CC:	Alex Tomas <alex@...sterfs.com>, Theodore Tso <tytso@...gle.com>
Subject: [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 <bosong.ly@...bao.com>
Cc: Alex Tomas <alex@...sterfs.com>
Cc: Theodore Tso <tytso@...gle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ