From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/5] xfs: remove xfs_file_wait_for_io
Date: Wed, 19 Oct 2016 08:24:54 -0700 [thread overview]
Message-ID: <20161019152454.GI26485@birch.djwong.org> (raw)
In-Reply-To: <1476881248-18669-5-git-send-email-hch@lst.de>
On Wed, Oct 19, 2016 at 02:47:27PM +0200, Christoph Hellwig wrote:
> filemap_write_and_wait_range operates on full pages, so there is no need
> for the rounding operations. Additionally this allows us to micro-optimize
> by skipping the second inode_dio_wait for a intra-file clone.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_file.c | 39 ++++++++++-----------------------------
> 1 file changed, 10 insertions(+), 29 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 0960264..a61be33 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -947,32 +947,6 @@ xfs_file_fallocate(
> return error;
> }
>
> -/*
> - * Flush all file writes out to disk.
> - */
> -static int
> -xfs_file_wait_for_io(
> - struct inode *inode,
> - loff_t offset,
> - size_t len)
> -{
> - loff_t rounding;
> - loff_t ioffset;
> - loff_t iendoffset;
> - loff_t bs;
> - int ret;
> -
> - bs = inode->i_sb->s_blocksize;
> - inode_dio_wait(inode);
> -
> - rounding = max_t(xfs_off_t, bs, PAGE_SIZE);
> - ioffset = round_down(offset, rounding);
> - iendoffset = round_up(offset + len, rounding) - 1;
> - ret = filemap_write_and_wait_range(inode->i_mapping, ioffset,
> - iendoffset);
> - return ret;
> -}
> -
> /* Hook up to the VFS reflink function */
> STATIC int
> xfs_file_share_range(
> @@ -1069,11 +1043,18 @@ xfs_file_share_range(
> if (same_inode && pos_out + blen > pos_in && pos_out < pos_in + blen)
> goto out_unlock;
>
> - /* Wait for the completion of any pending IOs on srcfile */
> - ret = xfs_file_wait_for_io(inode_in, pos_in, len);
> + /* Wait for the completion of any pending IOs on both files */
> + inode_dio_wait(inode_in);
> + if (!same_inode)
> + inode_dio_wait(inode_out);
> +
> + ret = filemap_write_and_wait_range(inode_in->i_mapping,
> + pos_in, pos_in + len - 1);
> if (ret)
> goto out_unlock;
> - ret = xfs_file_wait_for_io(inode_out, pos_out, len);
> +
> + ret = filemap_write_and_wait_range(inode_out->i_mapping,
> + pos_out, pos_out + len - 1);
> if (ret)
> goto out_unlock;
>
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-10-19 15:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 12:47 fix locking for the reflink operation V2 Christoph Hellwig
2016-10-19 12:47 ` [PATCH 1/5] xfs: remove the same fs check from xfs_file_share_range Christoph Hellwig
2016-10-19 12:47 ` [PATCH 2/5] xfs: fix the same_inode check in xfs_file_share_range Christoph Hellwig
2016-10-19 12:47 ` [PATCH 3/5] xfs: move inode locking from xfs_reflink_remap_range to xfs_file_share_range Christoph Hellwig
2016-10-19 12:47 ` [PATCH 4/5] xfs: remove xfs_file_wait_for_io Christoph Hellwig
2016-10-19 15:24 ` Darrick J. Wong [this message]
2016-10-19 12:47 ` [PATCH 5/5] xfs: merge xfs_reflink_remap_range and xfs_file_share_range Christoph Hellwig
2016-10-19 15:53 ` Darrick J. Wong
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=20161019152454.GI26485@birch.djwong.org \
--to=darrick.wong@oracle.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;
as well as URLs for NNTP newsgroup(s).