]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] Create xfs_iflags_test_and_clear helper function
authorChristoph Hellwig <hch@infradead.org>
Wed, 29 Aug 2007 01:44:50 +0000 (11:44 +1000)
committerTim Shimmin <tes@chook.melbourne.sgi.com>
Tue, 16 Oct 2007 01:38:36 +0000 (11:38 +1000)
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29496a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/xfs_inode.h
fs/xfs/xfs_vnodeops.c

index 79d724615c3977fa9cafb92edc7d40c9f720a23a..ea1e24effd49dc45f18205057c8e15c243a470ea 100644 (file)
@@ -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__ */
 
 
index f2c037a9564efa8e072fa5baa80d1ec90e520ce5..8ed7af3c5d63d3bdab304509641e2f32ecd10a65 100644 (file)
@@ -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);
        }