Message ID | 20240623053532.857496-9-hch@lst.de (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | [01/10] xfs: fix freeing speculative preallocations for preallocated files | expand |
On Sun, Jun 23, 2024 at 07:34:53AM +0200, Christoph Hellwig wrote: > If the XFS_IDIRTY_RELEASE flag is set, we are not going to free XFS_EOFBLOCKS_RELEASED ? > the eofblocks, so don't bother locking the inode or performing the > checks in xfs_can_free_eofblocks. It'll still be the case that ->destroy_inode will have the chance to delete the eofblocks if we don't do it here, correct? If so, then Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/xfs/xfs_file.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index de52aceabebc27..1903fa5568a37d 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -1245,9 +1245,9 @@ xfs_file_release( > */ > if (inode->i_nlink && > (file->f_mode & FMODE_WRITE) && > + !xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED) && > xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { > - if (xfs_can_free_eofblocks(ip) && > - !xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED)) { > + if (xfs_can_free_eofblocks(ip)) { > xfs_free_eofblocks(ip); > xfs_iflags_set(ip, XFS_EOFBLOCKS_RELEASED); > } > -- > 2.43.0 > >
On Mon, Jun 24, 2024 at 08:50:22AM -0700, Darrick J. Wong wrote: > On Sun, Jun 23, 2024 at 07:34:53AM +0200, Christoph Hellwig wrote: > > If the XFS_IDIRTY_RELEASE flag is set, we are not going to free > > XFS_EOFBLOCKS_RELEASED ? Yes. > > the eofblocks, so don't bother locking the inode or performing the > > checks in xfs_can_free_eofblocks. > > It'll still be the case that ->destroy_inode will have the chance to > delete the eofblocks if we don't do it here, correct? Yes.
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index de52aceabebc27..1903fa5568a37d 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1245,9 +1245,9 @@ xfs_file_release( */ if (inode->i_nlink && (file->f_mode & FMODE_WRITE) && + !xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED) && xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { - if (xfs_can_free_eofblocks(ip) && - !xfs_iflags_test(ip, XFS_EOFBLOCKS_RELEASED)) { + if (xfs_can_free_eofblocks(ip)) { xfs_free_eofblocks(ip); xfs_iflags_set(ip, XFS_EOFBLOCKS_RELEASED); }
If the XFS_IDIRTY_RELEASE flag is set, we are not going to free the eofblocks, so don't bother locking the inode or performing the checks in xfs_can_free_eofblocks. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/xfs_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)