mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: remain written times to update inode during fsync
Date: Fri, 30 Mar 2018 09:31:02 -0700	[thread overview]
Message-ID: <20180330163102.GD44823@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <f25729ee-cd16-0029-a8ff-1daa5b82dd06@huawei.com>

On 03/30, Chao Yu wrote:
> Hi Jaegeuk,
> 
> On 2018/3/30 13:51, Jaegeuk Kim wrote:
> > This fixes xfstests/generic/392.
> 
> Hmm... Could you please give more details about this issue and solution in
> commit message, since I can catch up the solution only with the code.

Yeah, I missed some explanation. :P

> 
> Thanks,
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/f2fs.h  | 15 +++++++++++++++
> >  fs/f2fs/inode.c |  4 ++++
> >  2 files changed, 19 insertions(+)
> > 
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 000f93f6767e..675c39d85111 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -664,6 +664,7 @@ struct f2fs_inode_info {
> >  	kprojid_t i_projid;		/* id for project quota */
> >  	int i_inline_xattr_size;	/* inline xattr size */
> >  	struct timespec i_crtime;	/* inode creation time */
> > +	struct timespec i_disk_time[4];	/* inode disk times */
> >  };
> >  
> >  static inline void get_extent_info(struct extent_info *ext,
> > @@ -2457,6 +2458,11 @@ static inline void clear_file(struct inode *inode, int type)
> >  	f2fs_mark_inode_dirty_sync(inode, true);
> >  }
> >  
> > +static inline bool time_equal(struct timespec a, struct timespec b)
> > +{
> > +	return (a.tv_sec == b.tv_sec) && (a.tv_nsec == b.tv_nsec);
> > +}
> > +
> >  static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
> >  {
> >  	bool ret;
> > @@ -2474,6 +2480,15 @@ static inline bool f2fs_skip_inode_update(struct inode *inode, int dsync)
> >  			i_size_read(inode) & ~PAGE_MASK)
> >  		return false;
> >  
> > +	if (!time_equal(F2FS_I(inode)->i_disk_time[0], inode->i_atime))
> > +		return false;
> > +	if (!time_equal(F2FS_I(inode)->i_disk_time[1], inode->i_ctime))
> > +		return false;
> > +	if (!time_equal(F2FS_I(inode)->i_disk_time[2], inode->i_mtime))
> > +		return false;
> > +	if (!time_equal(F2FS_I(inode)->i_disk_time[3], F2FS_I(inode)->i_crtime))
> > +		return false;
> > +
> >  	down_read(&F2FS_I(inode)->i_sem);
> >  	ret = F2FS_I(inode)->last_disk_size == i_size_read(inode);
> >  	up_read(&F2FS_I(inode)->i_sem);
> > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> > index 401f09ccce7e..70aba580f4b0 100644
> > --- a/fs/f2fs/inode.c
> > +++ b/fs/f2fs/inode.c
> > @@ -444,6 +444,10 @@ void update_inode(struct inode *inode, struct page *node_page)
> >  	if (inode->i_nlink == 0)
> >  		clear_inline_node(node_page);
> >  
> > +	F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
> > +	F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
> > +	F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
> > +	F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
> >  }
> >  
> >  void update_inode_page(struct inode *inode)
> > 

  reply	other threads:[~2018-03-30 16:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30  5:51 Jaegeuk Kim
2018-03-30 10:54 ` Chao Yu
2018-03-30 16:31   ` Jaegeuk Kim [this message]
2018-03-30 16:30 ` [PATCH v2] " Jaegeuk Kim
2018-04-03  2:29   ` Chao Yu
2018-04-03  5:23     ` Jaegeuk Kim
2018-04-03  7:17       ` Chao Yu
2018-04-03 16:08         ` Jaegeuk Kim
2018-04-04  1:27           ` Chao Yu
2018-04-03  5:22   ` [f2fs-dev] [PATCH v3] " Jaegeuk Kim

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=20180330163102.GD44823@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®