All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Theodore Tso <tytso@mit.edu>
Cc: cmm@us.ibm.com, sandeen@redhat.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH -V4] ext4: Use an rbtree for tracking blocks freed during transaction.
Date: Tue, 14 Oct 2008 12:17:33 +0530	[thread overview]
Message-ID: <20081014064733.GB23970@skywalker> (raw)
In-Reply-To: <20081014031225.GC9332@mit.edu>

On Mon, Oct 13, 2008 at 11:12:25PM -0400, Theodore Tso wrote:
> On Mon, Oct 13, 2008 at 03:54:06PM -0400, Theodore Tso wrote:
> > So we have two choices; one is that we change ext4_mb_free_metadata()
> > to break up freed extents into block group chunks, 
> 
> Never mind.  I took a closer look and realized that
> ext4_mb_free_blocks is already breaking up extents that span multiple
> block groups.
> 
> So the only thing we need is the change to avoid merging freed extents
> that cross block groups, per my patch.  I've updated the patch queue
> with such a fix so I can better test things out.
> 
> Aneesh, can you look and see if this makes sense?

Yes the patch looks fine. Some changes I made on top of this is below
I have sent the patch -V5 with the above changes

> 
> 						- Ted
> 
> ext4: Use an rbtree for tracking blocks freed during transaction.
> 
> From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> 
> 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.
> 

.......

> 
> +/*
> + * We can merge two free data extents of the physical blocks

s/of the/only if the/

> + * are contiguous, AND the extents were freed by the same transaction, 
> + * AND the blocks are associated with the same group.
> + */
> +static int can_merge(struct ext4_free_data *entry1,
> +			struct ext4_free_data *entry2)
> +{
> +	if ((entry1->t_tid == entry2->t_tid) &&
> +	    (entry1->group == entry2->group) &&
> +	    (entry1->start_blk + entry1->count) == entry2->start_blk)
> +		return 1;
> +	return 0;
> +}
> +
......

> +++ b/fs/ext4/mballoc.h
> @@ -98,23 +98,34 @@
> 
>  static struct kmem_cache *ext4_pspace_cachep;
>  static struct kmem_cache *ext4_ac_cachep;
> +static struct kmem_cache *ext4_free_ext_cachep;
> 
>  #ifdef EXT4_BB_MAX_BLOCKS
>  #undef EXT4_BB_MAX_BLOCKS
>  #endif
>  #define EXT4_BB_MAX_BLOCKS	30
> 

We don't need the above define.

> -struct ext4_free_metadata {
> -	ext4_group_t group;
> -	unsigned short num;
> -	ext4_grpblk_t  blocks[EXT4_BB_MAX_BLOCKS];
> +struct ext4_free_data {
> +	/* this links the free block information from group_info */
> +	struct rb_node node;
> +
> +	/* this links the free block information from ext4_sb_info */
>  	struct list_head list;
> +
> +	/* group which free block extent belongs */
> +	ext4_group_t group;
> +
> +	/* free block extent */
> +	ext4_grpblk_t start_blk;
> +	ext4_grpblk_t count;
> +
> +	/* transaction which freed this extent */
> +	tid_t	t_tid;
>  };
> 
>  struct ext4_group_info {
>  	unsigned long	bb_state;
> -	unsigned long	bb_tid;
> -	struct ext4_free_metadata *bb_md_cur;
> +	struct rb_root  bb_free_root;
>  	unsigned short	bb_first_free;
>  	unsigned short	bb_free;
>  	unsigned short	bb_fragments;

      reply	other threads:[~2008-10-14  6:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 16:15 [PATCH -V4] ext4: Use an rbtree for tracking blocks freed during transaction Aneesh Kumar K.V
2008-10-13 19:54 ` Theodore Tso
2008-10-14  3:12   ` Theodore Tso
2008-10-14  6:47     ` 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=20081014064733.GB23970@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.