linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4: try to relieve ext4_mb_discard_group_preallocations() from hard work in simple way
@ 2010-03-25 15:24 jing zhang
  2010-03-25 16:20 ` [PATCH 2/2] " jing zhang
  0 siblings, 1 reply; 2+ messages in thread
From: jing zhang @ 2010-03-25 15:24 UTC (permalink / raw)
  To: linux-ext4
  Cc: Theodore Ts'o, Andreas Dilger, Dave Kleikamp,
	Aneesh Kumar K. V

From: Jing Zhang <zj.barak@gmail.com>

Date: Wed Mar 25  23:15:06     2010

The function, ext4_mb_discard_group_preallocations(), works alone as
hard as possible without correct understanding its caller's good
thinking.

And now try to relieve it in simple way.

But the variable, free, may be replaced with freed.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger@sun.com>
Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Jing Zhang <zj.barak@gmail.com>

---

--- linux-2.6.32/fs/ext4/mballoc.c	2009-12-03 11:51:22.000000000 +0800
+++ ext4_mm_leak/mballoc-11-1.c	2010-03-25 23:06:00.000000000 +0800
@@ -3633,7 +3633,7 @@ repeat:
 		spin_lock(&pa->pa_lock);
 		if (atomic_read(&pa->pa_count)) {
 			spin_unlock(&pa->pa_lock);
-			busy = 1;
+			busy += 1;
 			continue;
 		}
 		if (pa->pa_deleted) {
@@ -3654,7 +3654,7 @@ repeat:
 	}

 	/* if we still need more blocks and some PAs were used, try again */
-	if (free < needed && busy) {
+	if (free < needed && needed <= free + busy) {
 		busy = 0;
 		ext4_unlock_group(sb, group);
 		/*

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

end of thread, other threads:[~2010-03-25 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 15:24 [PATCH 1/2] ext4: try to relieve ext4_mb_discard_group_preallocations() from hard work in simple way jing zhang
2010-03-25 16:20 ` [PATCH 2/2] " jing zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).