linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Kazuya Mio <k-mio@sx.jp.nec.com>
Cc: ext4 <linux-ext4@vger.kernel.org>, jan Kara <jack@suse.cz>,
	Andreas Dilger <adilger@dilger.ca>
Subject: Re: [PATCH v2] ext3: Update ctime in ext3_splice_branch() only when needed
Date: Wed, 8 Feb 2012 10:33:07 +0100	[thread overview]
Message-ID: <20120208093307.GB24625@quack.suse.cz> (raw)
In-Reply-To: <4F322585.3010407@sx.jp.nec.com>

On Wed 08-02-12 16:34:29, Kazuya Mio wrote:
> Currently ext3 updates ctime in ext3_splice_branch() which is called whenever
> we allocate one block. But it is wasteful because ext3 doesn't support
> nanosecond timestamp. This leads to a performance loss.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
  Thanks. The patch looks good. I've added it to my tree.

								Honza

> ---
>  fs/ext3/inode.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index 2d0afec..3c7fd63 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -756,6 +756,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
>  	struct ext3_block_alloc_info *block_i;
>  	ext3_fsblk_t current_block;
>  	struct ext3_inode_info *ei = EXT3_I(inode);
> +	struct timespec now;
>  
>  	block_i = ei->i_block_alloc_info;
>  	/*
> @@ -795,9 +796,11 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
>  	}
>  
>  	/* We are done with atomic stuff, now do the rest of housekeeping */
> -
> -	inode->i_ctime = CURRENT_TIME_SEC;
> -	ext3_mark_inode_dirty(handle, inode);
> +	now = CURRENT_TIME_SEC;
> +	if (!timespec_equal(&inode->i_ctime, &now) || !where->bh) {
> +		inode->i_ctime = now;
> +		ext3_mark_inode_dirty(handle, inode);
> +	}
>  	/* ext3_mark_inode_dirty already updated i_sync_tid */
>  	atomic_set(&ei->i_datasync_tid, handle->h_transaction->t_tid);
>  
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2012-02-08  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  7:34 [PATCH v2] ext3: Update ctime in ext3_splice_branch() only when needed Kazuya Mio
2012-02-08  9:33 ` Jan Kara [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=20120208093307.GB24625@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger@dilger.ca \
    --cc=k-mio@sx.jp.nec.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;
as well as URLs for NNTP newsgroup(s).