aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r--fs/xfs/xfs_vnodeops.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index e6e1d11dfdf2..c4c153900205 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -436,11 +436,7 @@ xfs_release(
436 if (ip->i_d.di_nlink == 0) 436 if (ip->i_d.di_nlink == 0)
437 return 0; 437 return 0;
438 438
439 if ((S_ISREG(ip->i_d.di_mode) && 439 if (xfs_can_free_eofblocks(ip, false)) {
440 (VFS_I(ip)->i_size > 0 ||
441 (VN_CACHED(VFS_I(ip)) > 0 || ip->i_delayed_blks > 0)) &&
442 (ip->i_df.if_flags & XFS_IFEXTENTS)) &&
443 (!(ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)))) {
444 440
445 /* 441 /*
446 * If we can't get the iolock just skip truncating the blocks 442 * If we can't get the iolock just skip truncating the blocks
@@ -516,13 +512,12 @@ xfs_inactive(
516 goto out; 512 goto out;
517 513
518 if (ip->i_d.di_nlink != 0) { 514 if (ip->i_d.di_nlink != 0) {
519 if ((S_ISREG(ip->i_d.di_mode) && 515 /*
520 (VFS_I(ip)->i_size > 0 || 516 * force is true because we are evicting an inode from the
521 (VN_CACHED(VFS_I(ip)) > 0 || ip->i_delayed_blks > 0)) && 517 * cache. Post-eof blocks must be freed, lest we end up with
522 (ip->i_df.if_flags & XFS_IFEXTENTS) && 518 * broken free space accounting.
523 (!(ip->i_d.di_flags & 519 */
524 (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) || 520 if (xfs_can_free_eofblocks(ip, true)) {
525 ip->i_delayed_blks != 0))) {
526 error = xfs_free_eofblocks(mp, ip, false); 521 error = xfs_free_eofblocks(mp, ip, false);
527 if (error) 522 if (error)
528 return VN_INACTIVE_CACHE; 523 return VN_INACTIVE_CACHE;