linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, Jeff Layton <jlayton@redhat.com>
Subject: Re: [PATCH] xfs: rewrite the fdatasync optimization
Date: Tue, 6 Feb 2018 08:23:56 +0100	[thread overview]
Message-ID: <20180206072356.GB1649@lst.de> (raw)
In-Reply-To: <20180205221726.c2hdvaairki27gxf@destitution>

On Tue, Feb 06, 2018 at 09:17:26AM +1100, Dave Chinner wrote:
> > Currently we need to the ilock over the log force in xfs_fsync so that we
> > can protect ili_fsync_fields against incorrect manipulation.
> > 
> > But if instead we add new XFS_ILOG_VERSION pseudo log area similar to the
> > timestamp one we can use that to just record the last dirty / fdatasync
> > dirty lsn as long as the inode is pinned, and clear it when unpinning to
> > avoid holding the ilock over I/O.
> 
> I thought that NFS requires the iversion changes to be made stable
> at the same time as the data changes they correspond to is made
> stable? i.e. NFS requires us to stabilise the on disk iversion field
> during fdatasync.

Yes, and this patch doesn't change that behavior.  The reason why the
new XFS_ILOG_VERSION flag is needed is to be able to check if
an fdatasync needs to flush out an inode log item.  This is done the
same way we did the XFS_ILOG_TIMESTAMP optimization, i.e. mark the
version updates as XFS_ILOG_VERSION, which gets propagatated to
XFS_ILOG_CORE when flushing (and we still commit every transaction
with a dirty inode), but we then use the ili_datasync_lsn field
that is only set if something that is not the timestamp or version
is logged to check in fdatasync if we need to force the log or not.

> 
> As it is, I think this change XFS_ILOG_VERSION change is unnecessary
> because Jeff Layton's changes to avoid iversion changes when the
> value is not being sampled has been merged. Hence iversion won't be
> changed on every write anymore unless NFS is in the picture and is
> sampling iversion. 

It still is needed.  We need to change i_version everytime we update
the timestamps (IFF it is queried in 4.15+), and we need to log every
transaction that updates timestamps and i_version.  But we do not need
to force out the log in fdatasync if only the timestamps and i_version
have changed.

So the only change in 4.15 is that for non-NFS workloads the change
might not matter that much, but the fundamental issue is the same.

> The change to use ili_datasync_lsn is what reduces the latency
> because the ilock is not held over the log force anymore. That's
> useful and stands alone from the iversion modification so I
> think, at minimum, this needs to be separated into two patches....

I can split it out.  XFS_ILOG_VERSION is the bit that makes our
old XFS_ILOG_TIMESTAMP optimization actually work on v5 file systems.

  reply	other threads:[~2018-02-06  7:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05  7:39 [PATCH] xfs: rewrite the fdatasync optimization Christoph Hellwig
2018-02-05 22:17 ` Dave Chinner
2018-02-06  7:23   ` Christoph Hellwig [this message]
2018-02-08 23:17     ` Dave Chinner
2018-02-13 15:04       ` Christoph Hellwig
2018-02-13 23:26         ` Dave Chinner
2018-02-14 15:53           ` Christoph Hellwig
2018-02-14 22:43             ` Dave Chinner

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=20180206072356.GB1649@lst.de \
    --to=hch@lst.de \
    --cc=david@fromorbit.com \
    --cc=jlayton@redhat.com \
    --cc=linux-xfs@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).