From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com,
Andreas Dilger <adilger@sun.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] -V3 ext4: Use an rbtree for tracking blocks freed during transaction.
Date: Mon, 13 Oct 2008 21:39:27 +0530 [thread overview]
Message-ID: <20081013160927.GA23970@skywalker> (raw)
In-Reply-To: <1223891210-18547-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
On Mon, Oct 13, 2008 at 03:16:50PM +0530, Aneesh Kumar K.V wrote:
> With this patch we track the block freed during a transaction using
> rb tree. We also make sure contiguous blocks freed are collected
> in one rb node.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
Andreas mentioned that when merging the free blocks extents we
should not merge extents from two different transaction.
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 2f38754..b29dead 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4430,7 +4432,12 @@ static void ext4_mb_poll_new_transaction(struct super_block *sb,
static int can_merge(struct ext4_free_data *entry1,
struct ext4_free_data *entry2)
{
- if (entry1->start_blk + entry1->count == entry2->start_blk)
+ /*
+ * Even though blocks are contiguous, we don't want to
+ * merge if they don't belong to the same transaction
+ */
+ if (entry1->t_tid == entry2->t_tid &&
+ (entry1->start_blk + entry1->count) == entry2->start_blk)
return 1;
return 0;
}
@@ -4454,6 +4461,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
new_entry->start_blk = block;
new_entry->group = group;
new_entry->count = count;
+ new_entry->t_tid = handle->h_transaction->t_tid;
new_node = &new_entry->node;
ext4_lock_group(sb, group);
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 07dff39..c82abb9 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -111,6 +111,11 @@ struct ext4_free_data {
*/
struct rb_node node;
+ /* this link the free block
+ * information from ext4_sb_info
+ */
+ struct list_head list;
+
/* group this free block
* extent belong
*/
@@ -120,10 +125,8 @@ struct ext4_free_data {
ext4_grpblk_t start_blk;
ext4_grpblk_t count;
- /* this link the free block
- * information from ext4_sb_info
- */
- struct list_head list;
+ /* transaction this extent belong */
+ tid_t t_tid;
};
struct ext4_group_info {
prev parent reply other threads:[~2008-10-13 16:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 9:46 [PATCH] -V3 ext4: Use an rbtree for tracking blocks freed during transaction Aneesh Kumar K.V
2008-10-13 16:09 ` Aneesh Kumar K.V [this message]
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=20081013160927.GA23970@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=adilger@sun.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).