linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/2] xfs: Fix xfs_flush_unmap_range() range for RT
Date: Tue, 7 May 2024 13:58:22 -0700	[thread overview]
Message-ID: <20240507205822.GR360919@frogsfrogsfrogs> (raw)
In-Reply-To: <20240503140337.3426159-2-john.g.garry@oracle.com>

On Fri, May 03, 2024 at 02:03:36PM +0000, John Garry wrote:
> Currently xfs_flush_unmap_range() does a flush for full FS blocks. Extend
> this to cover full RT extents so that any range overlap with start/end of
> the modification are clean and idle. 
> 
> This code change is originally from Dave Chinner.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>  fs/xfs/xfs_bmap_util.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 2e6f08198c07..da67c52d5f94 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -802,12 +802,16 @@ xfs_flush_unmap_range(
>  	xfs_off_t		offset,
>  	xfs_off_t		len)
>  {
> -	struct xfs_mount	*mp = ip->i_mount;
>  	struct inode		*inode = VFS_I(ip);
>  	xfs_off_t		rounding, start, end;
>  	int			error;
>  
> -	rounding = max_t(xfs_off_t, mp->m_sb.sb_blocksize, PAGE_SIZE);
> +	/*
> +	 * Make sure we extend the flush out to extent alignment
> +	 * boundaries so any extent range overlapping the start/end
> +	 * of the modification we are about to do is clean and idle.
> +	 */
> +	rounding = max_t(xfs_off_t, xfs_inode_alloc_unitsize(ip), PAGE_SIZE);
>  	start = round_down(offset, rounding);

round_down requires the divisor to be a power of two.

--D

>  	end = round_up(offset + len, rounding) - 1;
>  
> -- 
> 2.31.1
> 
> 

  parent reply	other threads:[~2024-05-07 20:58 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 [this message]
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

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=20240507205822.GR360919@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).