From: jing zhang Subject: Re: [PATCH] ext4: try fast merge operation in ext4_mb_free_metadata() Date: Thu, 25 Mar 2010 22:11:56 +0800 Message-ID: References: <87bpedd520.fsf@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: linux-ext4 , "Theodore Ts'o" , Andreas Dilger , Dave Kleikamp To: "Aneesh Kumar K. V" Return-path: Received: from mail-yw0-f172.google.com ([209.85.211.172]:51483 "EHLO mail-yw0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754522Ab0CYOL6 (ORCPT ); Thu, 25 Mar 2010 10:11:58 -0400 Received: by ywh2 with SMTP id 2so3381955ywh.33 for ; Thu, 25 Mar 2010 07:11:57 -0700 (PDT) In-Reply-To: <87bpedd520.fsf@linux.vnet.ibm.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: 2010/3/25, Aneesh Kumar K. V : > On Wed, 24 Mar 2010 21:32:39 +0800, jing zhang wrote: >> From: Jing Zhang >> >> Date: Wed Mar 24 21:30:22 2010 >> >> There may exist fast path for merge if merge-able. >> >> Cc: Theodore Ts'o >> Cc: Andreas Dilger >> Cc: Dave Kleikamp >> Signed-off-by: Jing Zhang >> >> --- >> >> --- linux-2.6.32/fs/ext4/mballoc.c 2009-12-03 11:51:22.000000000 +0800 >> +++ ext4_mm_leak/mballoc7.c 2010-03-24 21:27:24.000000000 +0800 >> @@ -4385,6 +4385,24 @@ ext4_mb_free_metadata(handle_t *handle, >> } >> } >> >> + if (parent) { >> + /* let's try fast path */ >> + entry = rb_entry(parent, struct ext4_free_data, node); >> + if (n == &parent->rb_left) { >> + if (can_merge(new_entry, entry)) { >> + entry->start_blk = new_entry->start_blk; >> + entry->count += new_entry->count; >> + /* and info the caller that new_entry is >> + * not used yet. >> + */ >> + return 0; > > return 0 on success so you may want -1 here Agree. - zj > >> + } >> + } >> + else if (can_merge(entry, new_entry)) { >> + entry->count += new_entry->count; >> + return 0; >> + } >> + } >> rb_link_node(new_node, parent, n); >> rb_insert_color(new_node, &db->bb_free_root); >> -- > > -aneesh >