public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	jack@suse.cz, pavel@suse.cz
Subject: Re: [PATCH] ext2: Update also inode on disk when dir is IS_DIRSYNC
Date: Tue, 13 Jan 2009 15:17:16 -0800	[thread overview]
Message-ID: <20090113151716.cefb738b.akpm@linux-foundation.org> (raw)
In-Reply-To: <1231850522-11074-1-git-send-email-jack@suse.cz>

On Tue, 13 Jan 2009 13:42:02 +0100
Jan Kara <jack@suse.cz> wrote:

> We used to just write changed page for IS_DIRSYNC inodes. But we also have to
> update directory inode itself just for the case that we've allocated a new
> block and changed i_size.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> CC: Pavel Machek <pavel@suse.cz>
> ---
>  fs/ext2/dir.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
>   Andrew, would you please merge the patch? Ext3 and ext4 don't have this
> problem BTW.
> 
> diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
> index 9a0fc40..7fba549 100644
> --- a/fs/ext2/dir.c
> +++ b/fs/ext2/dir.c
> @@ -94,11 +94,10 @@ static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
>  		i_size_write(dir, pos+len);
>  		mark_inode_dirty(dir);
>  	}
> +	unlock_page(page);
>  
>  	if (IS_DIRSYNC(dir))
> -		err = write_one_page(page, 1);
> -	else
> -		unlock_page(page);
> +		err = ext2_sync_inode(dir);
>  

But with this change we no longer sync the data page?  Don't we need
something like this:

static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
{
	struct address_space *mapping = page->mapping;
	struct inode *dir = mapping->host;
	int err = 0;

	dir->i_version++;
	block_write_end(NULL, mapping, pos, len, len, page, NULL);

	if (pos+len > dir->i_size) {
		i_size_write(dir, pos+len);
		mark_inode_dirty(dir);
	}

	if (IS_DIRSYNC(dir)) {
		err = write_one_page(page, 1);
		if (err == 0)
			err = ext2_sync_inode(dir);
	} else {
		unlock_page(page);
	}

	return err;
}

?

  parent reply	other threads:[~2009-01-13 23:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 12:42 [PATCH] ext2: Update also inode on disk when dir is IS_DIRSYNC Jan Kara
2009-01-13 13:08 ` Pavel Machek
2009-01-13 23:17 ` Andrew Morton [this message]
2009-01-14 15:12   ` Jan Kara

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=20090113151716.cefb738b.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /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