]> Pileus Git - ~andy/linux/commitdiff
[XFS] Use xfs_inode_clean() in more places
authorDavid Chinner <dgc@sgi.com>
Thu, 6 Mar 2008 02:43:59 +0000 (13:43 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Fri, 18 Apr 2008 01:37:51 +0000 (11:37 +1000)
Remove open coded checks for the whether the inode is clean and replace
them with an inlined function.

SGI-PV: 977461
SGI-Modid: xfs-linux-melb:xfs-kern:30503a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode_item.h
fs/xfs/xfs_vnodeops.c

index 040c0e41729bf8c44efa51ab4a568a6891383246..d7514f8317df424e2cb75dd3ce2ce09a28cac80e 100644 (file)
@@ -2118,13 +2118,6 @@ xfs_iunlink_remove(
        return 0;
 }
 
-STATIC_INLINE int xfs_inode_clean(xfs_inode_t *ip)
-{
-       return (((ip->i_itemp == NULL) ||
-               !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
-               (ip->i_update_core == 0));
-}
-
 STATIC void
 xfs_ifree_cluster(
        xfs_inode_t     *free_ip,
@@ -3004,7 +2997,6 @@ xfs_iflush_cluster(
        int                     ilist_size;
        xfs_inode_t             **ilist;
        xfs_inode_t             *iq;
-       xfs_inode_log_item_t    *iip;
        int                     nr_found;
        int                     clcount = 0;
        int                     bufwasdelwri;
@@ -3040,13 +3032,8 @@ xfs_iflush_cluster(
                 * is a candidate for flushing.  These checks will be repeated
                 * later after the appropriate locks are acquired.
                 */
-               iip = iq->i_itemp;
-               if ((iq->i_update_core == 0) &&
-                   ((iip == NULL) ||
-                    !(iip->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
-                     xfs_ipincount(iq) == 0) {
+               if (xfs_inode_clean(iq) && xfs_ipincount(iq) == 0)
                        continue;
-               }
 
                /*
                 * Try to get locks.  If any are unavailable or it is pinned,
@@ -3069,10 +3056,8 @@ xfs_iflush_cluster(
                 * arriving here means that this inode can be flushed.  First
                 * re-check that it's dirty before flushing.
                 */
-               iip = iq->i_itemp;
-               if ((iq->i_update_core != 0) || ((iip != NULL) &&
-                    (iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
-                       int error;
+               if (!xfs_inode_clean(iq)) {
+                       int     error;
                        error = xfs_iflush_int(iq, bp);
                        if (error) {
                                xfs_iunlock(iq, XFS_ILOCK_SHARED);
@@ -3176,8 +3161,7 @@ xfs_iflush(
         * If the inode isn't dirty, then just release the inode
         * flush lock and do nothing.
         */
-       if ((ip->i_update_core == 0) &&
-           ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
+       if (xfs_inode_clean(ip)) {
                ASSERT((iip != NULL) ?
                         !(iip->ili_item.li_flags & XFS_LI_IN_AIL) : 1);
                xfs_ifunlock(ip);
@@ -3343,8 +3327,7 @@ xfs_iflush_int(
         * If the inode isn't dirty, then just release the inode
         * flush lock and do nothing.
         */
-       if ((ip->i_update_core == 0) &&
-           ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
+       if (xfs_inode_clean(ip)) {
                xfs_ifunlock(ip);
                return 0;
        }
index bfe92ea17952a3764ffe284231ebb87120f38751..40513077ab36f71178d50a0df2a0505e56df0853 100644 (file)
@@ -168,6 +168,14 @@ static inline int xfs_ilog_fext(int w)
        return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
 }
 
+static inline int xfs_inode_clean(xfs_inode_t *ip)
+{
+       return (!ip->i_itemp ||
+               !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
+              !ip->i_update_core;
+}
+
+
 #ifdef __KERNEL__
 
 extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
index 14140f6225ba513cc0c68a38def2ea37a47aaec5..5390d124ad35a84caa2f8cf053b577f11001c088 100644 (file)
@@ -3454,7 +3454,6 @@ xfs_inode_flush(
        int             flags)
 {
        xfs_mount_t     *mp = ip->i_mount;
-       xfs_inode_log_item_t *iip = ip->i_itemp;
        int             error = 0;
 
        if (XFS_FORCED_SHUTDOWN(mp))
@@ -3464,8 +3463,7 @@ xfs_inode_flush(
         * Bypass inodes which have already been cleaned by
         * the inode flush clustering code inside xfs_iflush
         */
-       if ((ip->i_update_core == 0) &&
-           ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL)))
+       if (xfs_inode_clean(ip))
                return 0;
 
        /*