public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: mingming cao <cmm@us.ibm.com>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Badari Pulavarty <pbadari@us.ibm.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"ext2-devel@lists.sourceforge.net"
	<ext2-devel@lists.sourceforge.net>, Andrew Morton <akpm@osdl.org>
Subject: Re: [Ext2-devel] Ext3 -mm reservations code: is this fix really correct?
Date: 15 Oct 2004 13:29:04 -0700	[thread overview]
Message-ID: <1097872144.4591.54.camel@localhost.localdomain> (raw)
In-Reply-To: <1097858401.1968.148.camel@sisko.scot.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Fri, 2004-10-15 at 09:40, Stephen C. Tweedie wrote:
> Hi,
> 
> On Fri, 2004-10-15 at 17:01, mingming cao wrote:
> 
> > > Have I misunderstood something?
> > > 
> > You are correct, again:) We should do a search_reserve_window() from the
> > root.
> > 
> > I will post a fix for these two soon.
> 
> Thanks.  I'll be away for a few days so I probably won't be able to look
> at the fix until Wednesday next week.
> 

How about this? Haven't test it, will do it shortly.:)


Thanks,
Mingming


[-- Attachment #2: ext3_reservation_window_fix_fix.patch --]
[-- Type: text/plain, Size: 2424 bytes --]

---

 linux-2.6.9-rc1-mm5-ming/fs/ext3/balloc.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff -puN fs/ext3/balloc.c~ext3_reservation_window_fix_fix fs/ext3/balloc.c
--- linux-2.6.9-rc1-mm5/fs/ext3/balloc.c~ext3_reservation_window_fix_fix	2004-10-15 18:23:42.824158856 -0700
+++ linux-2.6.9-rc1-mm5-ming/fs/ext3/balloc.c	2004-10-15 20:16:06.037034680 -0700
@@ -184,9 +184,10 @@ goal_in_my_reservation(struct reserve_wi
  * if the goal is not in any window.
  * Returns NULL if there are no windows or if all windows start after the goal.
  */
-static struct reserve_window_node *search_reserve_window(struct rb_node *n,
+static struct reserve_window_node *search_reserve_window(struct rb_root *root,
 							 unsigned long goal)
 {
+	struct rb_node *n = root->rb_node;
 	struct reserve_window_node *rsv;
 
 	if (!n)
@@ -822,10 +823,10 @@ static int alloc_new_reservation(struct 
 		start_block = goal + group_first_block;
 
 	size = atomic_read(&my_rsv->rsv_goal_size);
-	/* if we have a old reservation, start the search from the old rsv */
 	if (!rsv_is_empty(&my_rsv->rsv_window)) {
 		/*
 		 * if the old reservation is cross group boundary
+		 * and if the goal is inside the old reservation window,
 		 * we will come here when we just failed to allocate from
 		 * the first part of the window. We still have another part
 		 * that belongs to the next group. In this case, there is no
@@ -838,10 +839,10 @@ static int alloc_new_reservation(struct 
 		 */
 
 		if ((my_rsv->rsv_start <= group_end_block) &&
-				(my_rsv->rsv_end > group_end_block))
+				(my_rsv->rsv_end > group_end_block) &&
+				(start_block <= my_rsv->rsv_start))
 			return -1;
 
-		search_head = search_reserve_window(&my_rsv->rsv_node, start_block);
 		if ((atomic_read(&my_rsv->rsv_alloc_hit) >
 		     (my_rsv->rsv_end - my_rsv->rsv_start + 1) / 2)) {
 			/*
@@ -855,14 +856,10 @@ static int alloc_new_reservation(struct 
 			atomic_set(&my_rsv->rsv_goal_size, size);
 		}
 	}
-	else {
-		/*
-		 * we don't have a reservation,
-		 * we set our goal(start_block) and
-		 * the list head for the search
-		 */
-		search_head = search_reserve_window(fs_rsv_root->rb_node, start_block);
-	}
+	/*
+	 * shift the search start to the window near the goal block
+	 */
+	search_head = search_reserve_window(fs_rsv_root, start_block);
 
 	/*
 	 * find_next_reservable_window() simply finds a reservable window

_

  reply	other threads:[~2004-10-15 20:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15 13:27 Ext3 -mm reservations code: is this fix really correct? Stephen C. Tweedie
2004-10-15 16:01 ` [Ext2-devel] " mingming cao
2004-10-15 16:40   ` Stephen C. Tweedie
2004-10-15 20:29     ` mingming cao [this message]
2004-10-15 22:20       ` Stephen C. Tweedie
2004-10-15 22:34         ` mingming cao
2004-10-18 22:55           ` [PATCH 2/3] ext3 reservation allow turn off for specifed file Mingming Cao
2004-10-18 23:42             ` Andrew Morton
2004-10-19  1:01               ` Mingming Cao
2004-10-20 17:55                 ` Ray Lee
2004-10-25 20:33                   ` [Ext2-devel] " Mingming Cao
2004-10-25 23:05                     ` Mingming Cao
2004-10-25 23:45                       ` Andrew Morton
2004-10-26 16:53                         ` Mingming Cao
2004-10-26 20:18                           ` Andrew Morton
2004-10-26 23:01                             ` Mingming Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097872144.4591.54.camel@localhost.localdomain \
    --to=cmm@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    --cc=sct@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox