提交 09262b43 编写于 作者: C Christoph Hellwig 提交者: Tim Shimmin

[XFS] Create xfs_iflags_test_and_clear helper function

SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29496a
Signed-off-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NDavid Chinner <dgc@sgi.com>
Signed-off-by: NTim Shimmin <tes@sgi.com>
上级 b3aea4ed
......@@ -360,6 +360,19 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
spin_unlock(&ip->i_flags_lock);
return ret;
}
static inline int
xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
{
int ret;
spin_lock(&ip->i_flags_lock);
ret = ip->i_flags & flags;
if (ret)
ip->i_flags &= ~flags;
spin_unlock(&ip->i_flags_lock);
return ret;
}
#endif /* __KERNEL__ */
......
......@@ -1541,12 +1541,7 @@ xfs_release(
* significantly reducing the time window where we'd otherwise
* be exposed to that problem.
*/
spin_lock(&ip->i_flags_lock);
truncated = __xfs_iflags_test(ip, XFS_ITRUNCATED);
if (truncated)
ip->i_flags &= ~XFS_ITRUNCATED;
spin_unlock(&ip->i_flags_lock);
truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册