Message ID | 20240503140337.3426159-2-john.g.garry@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs: fallocate RT flush unmap range fixes | expand |
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
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 > >
On 07/05/2024 21:58, Darrick J. Wong wrote: >> - 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. well spotted, and so the round_up() call, below, also needs fixing. > > --D > >> end = round_up(offset + len, rounding) - 1;
On 07/05/2024 21:58, Darrick J. Wong wrote: >> - 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. well spotted, and so the round_up() call, below, also needs fixing. > > --D > >> end = round_up(offset + len, rounding) - 1;
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;
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(-)