public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: reduce ilock acquisitions in xfs_file_fsync
Date: Mon, 25 Jan 2021 08:16:18 -0500	[thread overview]
Message-ID: <20210125131618.GA2047559@bfoster> (raw)
In-Reply-To: <20210122164643.620257-3-hch@lst.de>

On Fri, Jan 22, 2021 at 05:46:43PM +0100, Christoph Hellwig wrote:
> If the inode is not pinned by the time fsync is called we don't need the
> ilock to protect against concurrent clearing of ili_fsync_fields as the
> inode won't need a log flush or clearing of these fields.  Not taking
> the iolock allows for full concurrency of fsync and thus O_DSYNC
> completions with io_uring/aio write submissions.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_file.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 588232c77f11e0..ffe2d7c37e26cd 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -200,7 +200,14 @@ xfs_file_fsync(
>  	else if (mp->m_logdev_targp != mp->m_ddev_targp)
>  		xfs_blkdev_issue_flush(mp->m_ddev_targp);
>  
> -	error = xfs_fsync_flush_log(ip, datasync, &log_flushed);
> +	/*
> +	 * Any inode that has dirty modifications in the log is pinned.  The
> +	 * racy check here for a pinned inode while not catch modifications

s/while/will/ ?

Otherwise looks good:

Reviewed-by: Brian Foster <bfoster@redhat.com>

> +	 * that happen concurrently to the fsync call, but fsync semantics
> +	 * only require to sync previously completed I/O.
> +	 */
> +	if (xfs_ipincount(ip))
> +		error = xfs_fsync_flush_log(ip, datasync, &log_flushed);
>  
>  	/*
>  	 * If we only have a single device, and the log force about was
> -- 
> 2.29.2
> 


  parent reply	other threads:[~2021-01-26  3:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 16:46 avoid taking the iolock in fsync unless actually needed v2 Christoph Hellwig
2021-01-22 16:46 ` [PATCH 1/2] xfs: refactor xfs_file_fsync Christoph Hellwig
2021-01-22 21:08   ` Dave Chinner
2021-01-22 16:46 ` [PATCH 2/2] xfs: reduce ilock acquisitions in xfs_file_fsync Christoph Hellwig
2021-01-22 21:08   ` Dave Chinner
2021-01-23  6:41     ` Christoph Hellwig
2021-01-26  6:56       ` Christoph Hellwig
2021-01-25 13:16   ` Brian Foster [this message]
2021-01-28  8:00     ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2021-01-11 16:15 avoid taking the iolock in fsync unless actually needed Christoph Hellwig
2021-01-11 16:15 ` [PATCH 2/2] xfs: reduce ilock acquisitions in xfs_file_fsync Christoph Hellwig
2021-01-12 15:34   ` Brian Foster

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=20210125131618.GA2047559@bfoster \
    --to=bfoster@redhat.com \
    --cc=hch@lst.de \
    --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