From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Alex Tomas <alex@clusterfs.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] basic delayed allocation in ext4
Date: Thu, 26 Jul 2007 17:05:28 +0530 [thread overview]
Message-ID: <46A88700.2090807@linux.vnet.ibm.com> (raw)
In-Reply-To: <46A86294.6050608@clusterfs.com>
Alex Tomas wrote:
> Good day,
>
> please review ...
>
> thanks, Alex
>
> Basic delayed allocation in ext4
>
> Two special ->get_block() methods are introduced:
>
> * ext4_da_get_block_prep()
> to be used with ->prepare_write(), defers allocation till flush
> * ext4_da_get_block_write()
> to be used with mpage_da_writepages(), allocate blocks and correct
> on-disk size
>
> Current implementation works with data=writeback only, you should
> mount filesystem with delalloc,data=writeback options.
>
> TODO:
> * reservation
> * data=ordered
> * quota
> * bmap
>
> Signed-off-by: Alex Tomas <alex@clusterfs.com>
>
[.. snip...]
> /*
> * Test whether an inode is a fast symlink.
> */
> @@ -1291,6 +1293,142 @@ static int ext4_journalled_commit_write(
> }
>
> /*
> + * this is a special callback for ->prepare_write() only
> + * it's intention is to return mapped block or reserve space
> + */
> +static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
> + struct buffer_head *bh_result, int create)
> +{
> + int ret = 0;
> +
> + BUG_ON(create == 0);
> + BUG_ON(bh_result->b_size != inode->i_sb->s_blocksize);
> +
> + /* first, we need to know whether the block is allocated already
> + * XXX: when the filesystem has a lot of free blocks, we could
> + * reserve even allocated blocks to save this lookup */
> + ret = ext4_get_blocks_wrap(NULL, inode, iblock, 1, bh_result, 0, 0);
> + if (ret >= 0) {
I guess this should be (ret > 0)
> + if (buffer_mapped(bh_result)) {
> + bh_result->b_size = (ret << inode->i_blkbits);
> + } else {
> + /* OK, the block isn't allocated yet, let's reserve space */
> + /* XXX: call reservation here */
[...snip..]
epare_write(struct file *file, struct page *page,
> + unsigned from, unsigned to)
> +{
> + return block_prepare_write(page, from, to, ext4_da_get_block_prep);
> +}
> +
> + return ret;
> +}
> +
> +static int ext4_da_writepages(struct address_space *mapping,
> + struct writeback_control *wbc)
> +{
> + return mpage_da_writepages(mapping, wbc, ext4_da_get_block_write);
> +}
I was not able to find mpage_da_writepages()..
-aneesh
next prev parent reply other threads:[~2007-07-26 11:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 9:00 [RFC] basic delayed allocation in ext4 Alex Tomas
2007-07-26 11:35 ` Aneesh Kumar K.V [this message]
2007-07-26 11:50 ` Alex Tomas
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=46A88700.2090807@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=alex@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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 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.