aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_inode.h13
-rw-r--r--fs/xfs/xfs_vnodeops.c7
2 files changed, 14 insertions, 6 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 79d724615c39..ea1e24effd49 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -360,6 +360,19 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
360 spin_unlock(&ip->i_flags_lock); 360 spin_unlock(&ip->i_flags_lock);
361 return ret; 361 return ret;
362} 362}
363
364static inline int
365xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
366{
367 int ret;
368
369 spin_lock(&ip->i_flags_lock);
370 ret = ip->i_flags & flags;
371 if (ret)
372 ip->i_flags &= ~flags;
373 spin_unlock(&ip->i_flags_lock);
374 return ret;
375}
363#endif /* __KERNEL__ */ 376#endif /* __KERNEL__ */
364 377
365 378
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index f2c037a9564e..8ed7af3c5d63 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1541,12 +1541,7 @@ xfs_release(
1541 * significantly reducing the time window where we'd otherwise 1541 * significantly reducing the time window where we'd otherwise
1542 * be exposed to that problem. 1542 * be exposed to that problem.
1543 */ 1543 */
1544 spin_lock(&ip->i_flags_lock); 1544 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
1545 truncated = __xfs_iflags_test(ip, XFS_ITRUNCATED);
1546 if (truncated)
1547 ip->i_flags &= ~XFS_ITRUNCATED;
1548 spin_unlock(&ip->i_flags_lock);
1549
1550 if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0) 1545 if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
1551 xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE); 1546 xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
1552 } 1547 }