All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: ext4 <linux-ext4@vger.kernel.org>
Cc: Mingming Cao <cmm@us.ibm.com>, Eric Sandeen <sandeen@redhat.com>
Subject: Re: BUG with delayed allocation
Date: Thu, 20 Mar 2008 09:51:58 +0530	[thread overview]
Message-ID: <20080320042157.GC6967@skywalker> (raw)
In-Reply-To: <20080319183255.GA15209@skywalker>

This mail didn't seem to reach the list.

-aneesh

On Thu, Mar 20, 2008 at 12:02:55AM +0530, Aneesh Kumar K.V wrote:
> On Wed, Mar 19, 2008 at 09:42:13AM -0500, Eric Sandeen wrote:
> > Aneesh Kumar K.V wrote:
> > > Hi,
> > > 
> > > Eric actually observed it yesterday. I am able to reproduce it locally.
> > > With delayed allocation we are observing wrong value of i_size.
> > > 
> > > kenrel: 2.6.25-rc5 +
> > > With all the patches in the patch queue
> > 
> > ...
> > 
> > I also see this with only:
> > 
> > patches/delalloc-vfs.patch
> > patches/delalloc-ext4.patch
> > 
> > applied.
> 
> This one seems to work for me. Need to think a bit more about parallel
> truncate.
> 
> -aneesh
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 79930df..b74426d 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1488,6 +1488,43 @@ out:
>  
>  	return ret;
>  }
> +static int ext4_da_writepage(struct page *page,
> +				struct writeback_control *wbc)
> +{
> +	struct inode *inode = page->mapping->host;
> +	handle_t *handle = NULL;
> +	int ret = 0;
> +	int err;
> +
> +	if (ext4_journal_current_handle())
> +		goto out_fail;
> +
> +	handle = ext4_journal_start(inode, ext4_writepage_trans_blocks(inode));
> +	if (IS_ERR(handle)) {
> +		ret = PTR_ERR(handle);
> +		goto out_fail;
> +	}
> +
> +	if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))
> +		ret = nobh_writepage(page, ext4_get_block, wbc);
> +	else
> +		ret = block_write_full_page(page, ext4_get_block, wbc);
> +
> +	if (!ret && inode->i_size > EXT4_I(inode)->i_disksize) {
> +		EXT4_I(inode)->i_disksize = inode->i_size;
> +		ext4_mark_inode_dirty(handle, inode);
> +	}
> +
> +	err = ext4_journal_stop(handle);
> +	if (!ret)
> +		ret = err;
> +	return ret;
> +
> +out_fail:
> +	redirty_page_for_writepage(wbc, page);
> +	unlock_page(page);
> +	return ret;
> +}
>  
>  static int ext4_da_writepages(struct address_space *mapping,
>  				struct writeback_control *wbc)
> @@ -2015,7 +2052,7 @@ static const struct address_space_operations ext4_journalled_aops = {
>  static const struct address_space_operations ext4_da_aops = {
>  	.readpage	= ext4_readpage,
>  	.readpages	= ext4_readpages,
> -	.writepage	= ext4_writeback_writepage,
> +	.writepage	= ext4_da_writepage,
>  	.writepages	= ext4_da_writepages,
>  	.sync_page	= block_sync_page,
>  	.write_begin	= ext4_da_write_begin,

  reply	other threads:[~2008-03-20  4:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19  8:52 BUG with delayed allocation Aneesh Kumar K.V
2008-03-19 14:42 ` Eric Sandeen
2008-03-19 18:32   ` Aneesh Kumar K.V
2008-03-20  4:21     ` Aneesh Kumar K.V [this message]
2008-03-20  0:46 ` Mingming Cao
2008-03-20  5:39   ` Aneesh Kumar K.V
2008-03-20 17:29     ` Mingming Cao
2008-03-20 17:56       ` Aneesh Kumar K.V
2008-03-20 23:55         ` Andreas Dilger

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