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:54:18 +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 5/5] mballoc: don't change cpa if cur_distance is equal to
 new_distance

In ext4_mb_check_group_pa(), cur_distance is selected to return only
when it's smaller than new_distance, this is unreasonable. If
cur_distance is equal to new_distance, current code will return
new_distance to update cpa from ext4_mb_use_preallocated(), which doesn't
make any sense.

This patch makes new_distance to return only when it's smaller then
cur_distance, which avoids unnecessary cpa update in
ext4_mb_use_preallocated().

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 |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 569cff6..af706f6 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3181,7 +3181,7 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
  	cur_distance = abs(goal_block - cpa->pa_pstart);
  	new_distance = abs(goal_block - pa->pa_pstart);

-	if (cur_distance < new_distance)
+	if (cur_distance <= new_distance)
  		return cpa;

  	/* drop the previous reference */
-- 
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