Linux-XFS Archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: chandan.babu@oracle.com, dchinner@redhat.com, djwong@kernel.org,
	hch@lst.de
Cc: linux-xfs@vger.kernel.org, John Garry <john.g.garry@oracle.com>
Subject: [PATCH RFC 1/2] xfs: Fix xfs_flush_unmap_range() range for RT
Date: Fri,  3 May 2024 14:03:36 +0000	[thread overview]
Message-ID: <20240503140337.3426159-2-john.g.garry@oracle.com> (raw)
In-Reply-To: <20240503140337.3426159-1-john.g.garry@oracle.com>

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);
 	end = round_up(offset + len, rounding) - 1;
 
-- 
2.31.1


  reply	other threads:[~2024-05-03 14:04 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 ` John Garry [this message]
2024-05-07  6:36   ` [PATCH RFC 1/2] xfs: Fix xfs_flush_unmap_range() range for RT 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

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=20240503140337.3426159-2-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=chandan.babu@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).