From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2120.oracle.com ([156.151.31.85]:45750 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbeKUJZp (ORCPT ); Wed, 21 Nov 2018 04:25:45 -0500 Date: Tue, 20 Nov 2018 14:53:55 -0800 From: "Darrick J. Wong" Subject: Re: [PATCH 5/7] xfs: extent shifting doesn't fully invalidate page cache Message-ID: <20181120225355.GI6792@magnolia> References: <20181119210459.8506-1-david@fromorbit.com> <20181119210459.8506-6-david@fromorbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119210459.8506-6-david@fromorbit.com> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Dave Chinner Cc: linux-xfs@vger.kernel.org On Tue, Nov 20, 2018 at 08:04:57AM +1100, Dave Chinner wrote: > From: Dave Chinner > > The extent shifting code uses a flush and invalidate mechainsm prior > to shifting extents around. This is similar to what > xfs_free_file_space() does, but it doesn't take into account things > like page cache vs block size differences, and it will fail if there > is a page that it currently busy. > > xfs_flush_unmap_range() handles all of these cases, so just convert > xfs_prepare_shift() to us that mechanism rather than having it's own > special sauce. > > Signed-off-by: Dave Chinner Looks ok, Reviewed-by: Darrick J. Wong --D > --- > fs/xfs/xfs_bmap_util.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > index 5d263dfdb3bc..167ff4297e5c 100644 > --- a/fs/xfs/xfs_bmap_util.c > +++ b/fs/xfs/xfs_bmap_util.c > @@ -1195,13 +1195,7 @@ xfs_prepare_shift( > * Writeback and invalidate cache for the remainder of the file as we're > * about to shift down every extent from offset to EOF. > */ > - error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, offset, -1); > - if (error) > - return error; > - error = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, > - offset >> PAGE_SHIFT, -1); > - if (error) > - return error; > + error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip)); > > /* > * Clean out anything hanging around in the cow fork now that > -- > 2.19.1 >