linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Changman Lee <cm224.lee@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 07/11] f2fs: enable in-place-update for fdatasync
Date: Tue, 29 Jul 2014 05:22:15 -0700	[thread overview]
Message-ID: <20140729122215.GB84378@jaegeuk-mac02> (raw)
In-Reply-To: <20140729004111.GA442@lcm>

Hi Changman,

On Tue, Jul 29, 2014 at 09:41:11AM +0900, Changman Lee wrote:
> Hi Jaegeuk,
> 
> On Fri, Jul 25, 2014 at 03:47:21PM -0700, Jaegeuk Kim wrote:
> > This patch enforces in-place-updates only when fdatasync is requested.
> > If we adopt this in-place-updates for the fdatasync, we can skip to write the
> > recovery information.
> 
> But, as you know, random write occurs when changing into in-place-updates.
> It will degrade write performance. Is there any case in-place-updates is
> better, except recovery or high utilization?

As I described, you can easily imagine, if users requested small amount of data
writes with fdatasync, we should do data writes + node writes.
But, if we can do in-place-update, we don't need to write node blocks.
Surely it triggers random writes, however, the amount of data is preety small
and the device handles them very fast by its inside cache, so that it can
enhance the performance.

Thanks,

> 
> Thanks
> 
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/f2fs.h    | 1 +
> >  fs/f2fs/file.c    | 7 +++++++
> >  fs/f2fs/segment.h | 4 ++++
> >  3 files changed, 12 insertions(+)
> > 
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index ab36025..8f8685e 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -998,6 +998,7 @@ enum {
> >  	FI_INLINE_DATA,		/* used for inline data*/
> >  	FI_APPEND_WRITE,	/* inode has appended data */
> >  	FI_UPDATE_WRITE,	/* inode has in-place-update data */
> > +	FI_NEED_IPU,		/* used fo ipu for fdatasync */
> >  };
> >  
> >  static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag)
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index 121689a..e339856 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -127,11 +127,18 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
> >  		return 0;
> >  
> >  	trace_f2fs_sync_file_enter(inode);
> > +
> > +	/* if fdatasync is triggered, let's do in-place-update */
> > +	if (datasync)
> > +		set_inode_flag(fi, FI_NEED_IPU);
> > +
> >  	ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
> >  	if (ret) {
> >  		trace_f2fs_sync_file_exit(inode, need_cp, datasync, ret);
> >  		return ret;
> >  	}
> > +	if (datasync)
> > +		clear_inode_flag(fi, FI_NEED_IPU);
> >  
> >  	/*
> >  	 * if there is no written data, don't waste time to write recovery info.
> > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
> > index ee5c75e..55973f7 100644
> > --- a/fs/f2fs/segment.h
> > +++ b/fs/f2fs/segment.h
> > @@ -486,6 +486,10 @@ static inline bool need_inplace_update(struct inode *inode)
> >  	if (S_ISDIR(inode->i_mode))
> >  		return false;
> >  
> > +	/* this is only set during fdatasync */
> > +	if (is_inode_flag_set(F2FS_I(inode), FI_NEED_IPU))
> > +		return true;
> > +
> >  	switch (SM_I(sbi)->ipu_policy) {
> >  	case F2FS_IPU_FORCE:
> >  		return true;
> > -- 
> > 1.8.5.2 (Apple Git-48)
> > 
> > 
> > ------------------------------------------------------------------------------
> > Want fast and easy access to all the code in your enterprise? Index and
> > search up to 200,000 lines of code with a free copy of Black Duck
> > Code Sight - the same software that powers the world's largest code
> > search on Ohloh, the Black Duck Open Hub! Try it now.
> > http://p.sf.net/sfu/bds
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2014-07-29 12:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 22:47 [PATCH 01/11] f2fs: add nobarrier mount option Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 02/11] f2fs: punch the core function for inode management Jaegeuk Kim
2014-07-29 11:29   ` Chao Yu
2014-07-25 22:47 ` [PATCH 03/11] f2fs: add infra for ino management Jaegeuk Kim
2014-07-29 11:30   ` Chao Yu
2014-07-25 22:47 ` [PATCH 04/11] f2fs: use radix_tree " Jaegeuk Kim
2014-07-29 11:32   ` Chao Yu
2014-07-29 12:34     ` Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 05/11] f2fs: add info of appended or updated data writes Jaegeuk Kim
2014-07-29 11:38   ` Chao Yu
2014-07-25 22:47 ` [PATCH 06/11] f2fs: skip unnecessary data writes during fsync Jaegeuk Kim
2014-07-29 11:39   ` Chao Yu
2014-07-29 12:43     ` Jaegeuk Kim
2014-07-30 11:58       ` Chao Yu
2014-07-25 22:47 ` [PATCH 07/11] f2fs: enable in-place-update for fdatasync Jaegeuk Kim
2014-07-29  0:41   ` Changman Lee
2014-07-29 12:22     ` Jaegeuk Kim [this message]
2014-07-29 23:54       ` Changman Lee
2014-07-30  1:08         ` Jaegeuk Kim
2014-07-30  1:56           ` [f2fs-dev] " Changman Lee
2014-07-30  3:11             ` Jaegeuk Kim
2014-07-30  2:45           ` [f2fs-dev] " Chao Yu
2014-07-30  3:13             ` Jaegeuk Kim
2014-07-30 12:48               ` [f2fs-dev] " Chao Yu
2014-07-25 22:47 ` [PATCH 08/11] f2fs: fix wrong condition for unlikely Jaegeuk Kim
2014-07-30  1:44   ` Chao Yu
2014-07-30  3:18     ` Jaegeuk Kim
2014-07-30 12:58       ` Chao Yu
2014-07-25 22:47 ` [PATCH 09/11] f2fs: test before set/clear bits Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 10/11] f2fs: avoid checkpoint when error was occurred Jaegeuk Kim
2014-07-29 11:41   ` Chao Yu
2014-07-29 13:00     ` Jaegeuk Kim
2014-07-25 22:47 ` [PATCH 11/11] f2fs: avoid retrying wrong recovery routine " Jaegeuk Kim
2014-07-29 13:01   ` [PATCH v2 " Jaegeuk Kim
2014-07-29 11:28 ` [PATCH 01/11] f2fs: add nobarrier mount option Chao Yu
2014-07-29 12:22   ` 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=20140729122215.GB84378@jaegeuk-mac02 \
    --to=jaegeuk@kernel.org \
    --cc=cm224.lee@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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).