From: "Darrick J. Wong" <djwong@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: chandan.babu@oracle.com, dchinner@redhat.com, hch@lst.de,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH RFC 2/2] xfs: Fix xfs_prepare_shift() range for RT
Date: Tue, 7 May 2024 14:02:13 -0700 [thread overview]
Message-ID: <20240507210213.GS360919@frogsfrogsfrogs> (raw)
In-Reply-To: <20240503140337.3426159-3-john.g.garry@oracle.com>
On Fri, May 03, 2024 at 02:03:37PM +0000, John Garry wrote:
> The RT extent range must be considered in the xfs_flush_unmap_range() call
> to stabilize the boundary.
>
> This code change is originally from Dave Chinner.
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
> fs/xfs/xfs_bmap_util.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index da67c52d5f94..2775bb32489e 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -896,8 +896,8 @@ xfs_prepare_shift(
> struct xfs_inode *ip,
> loff_t offset)
> {
> - struct xfs_mount *mp = ip->i_mount;
> int error;
> + unsigned int rounding;
>
> /*
> * Trim eofblocks to avoid shifting uninitialized post-eof preallocation
> @@ -914,11 +914,13 @@ xfs_prepare_shift(
> * with the full range of the operation. If we don't, a COW writeback
> * completion could race with an insert, front merge with the start
> * extent (after split) during the shift and corrupt the file. Start
> - * with the block just prior to the start to stabilize the boundary.
> + * with the aligned block just prior to the start to stabilize the
"...with the allocation unit just prior to the start..."
> + * boundary.
> */
> - offset = round_down(offset, mp->m_sb.sb_blocksize);
> + rounding = xfs_inode_alloc_unitsize(ip);
> + offset = round_down(offset, rounding);
Again, round_down requires the divisor to be a power of two.
--D
> if (offset)
> - offset -= mp->m_sb.sb_blocksize;
> + offset -= rounding;
>
> /*
> * Writeback and invalidate cache for the remainder of the file as we're
> --
> 2.31.1
>
>
prev parent reply other threads:[~2024-05-07 21:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 14:03 [PATCH RFC 0/2] xfs: fallocate RT flush unmap range fixes John Garry
2024-05-03 14:03 ` [PATCH RFC 1/2] xfs: Fix xfs_flush_unmap_range() range for RT John Garry
2024-05-07 6:36 ` Christoph Hellwig
2024-05-07 20:58 ` Darrick J. Wong
2024-05-08 6:39 ` John Garry
2024-05-08 6:40 ` John Garry
2024-05-03 14:03 ` [PATCH RFC 2/2] xfs: Fix xfs_prepare_shift() " John Garry
2024-05-07 6:37 ` Christoph Hellwig
2024-05-07 21:02 ` Darrick J. Wong [this message]
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=20240507210213.GS360919@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.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).