public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Mingming <cmm@us.ibm.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] delalloc: Add block reservation estimate for non-extent files
Date: Sat, 21 Jun 2008 15:55:20 +0530	[thread overview]
Message-ID: <20080621102520.GA9584@skywalker> (raw)
In-Reply-To: <1214010691.27507.223.camel@BVR-FS.beaverton.ibm.com>

On Fri, Jun 20, 2008 at 06:11:31PM -0700, Mingming wrote:
> Add support for full delayed allocation over ext3 format file.
> 
> This patch added a function to estimate the number of indirect blocks need
> to reserve for non-extent based (ext3) file, in order to properly
> reserve the need amount of indirect blocks for delayed allocation.
> 
> 
> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> ---
>  fs/ext4/inode.c |   34 ++++++++++++++++++++++++++++++++--
>  1 file changed, 32 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.26-rc6/fs/ext4/inode.c
> ===================================================================
> --- linux-2.6.26-rc6.orig/fs/ext4/inode.c	2008-06-20 16:50:09.000000000 -0700
> +++ linux-2.6.26-rc6/fs/ext4/inode.c	2008-06-20 17:36:08.000000000 -0700
> @@ -1426,6 +1426,36 @@ static int ext4_journalled_write_end(str
> 
>  	return ret ? ret : copied;
>  }
> +/*
> + * Calculate the number of metadata blocks need to reserve
> + * to allocate @blocks for non extent file based file
> + */
> +static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
> +{
> +	int icap = EXT4_ADDR_PER_BLOCK(inode->i_sb);
> +	int ind_blks, dind_blks, tind_blks;
> +
> +	/* number of new indirect blocks needed */
> +	ind_blks = (blocks + icap - 1) / icap;
> +
> +	dind_blks = (ind_blks + icap - 1) / icap;
> +
> +	tind_blks = 1;
> +
> +	return ind_blks + dind_blks + tind_blks;
> +}
> +

With block mapped files using logical block number we should be able to
find out the exact number of meta-data blocks we would need. I am not sure
whether we need to be that complex is calculating the same.

-aneesh

  reply	other threads:[~2008-06-21 10:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-21  1:11 [PATCH] delalloc: Add block reservation estimate for non-extent files Mingming
2008-06-21 10:25 ` Aneesh Kumar K.V [this message]
2008-06-23 18:57   ` Mingming

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=20080621102520.GA9584@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    /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