aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Chinner <dgc@sgi.com>2008-03-05 21:43:59 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-04-17 21:37:51 -0400
commit3354040897f828644be6ca5783588e9f64a53b8e (patch)
treec41cfb4584e13225b1f4578e64c8739d88a8537c /fs
parentbad5584332e888ac40ca13584e8c114149ddb01e (diff)
[XFS] Use xfs_inode_clean() in more places
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_inode.c27
-rw-r--r--fs/xfs/xfs_inode_item.h8
-rw-r--r--fs/xfs/xfs_vnodeops.c4
3 files changed, 14 insertions, 25 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 040c0e41729b..d7514f8317df 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2118,13 +2118,6 @@ xfs_iunlink_remove(
2118 return 0; 2118 return 0;
2119} 2119}
2120 2120
2121STATIC_INLINE int xfs_inode_clean(xfs_inode_t *ip)
2122{
2123 return (((ip->i_itemp == NULL) ||
2124 !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
2125 (ip->i_update_core == 0));
2126}
2127
2128STATIC void 2121STATIC void
2129xfs_ifree_cluster( 2122xfs_ifree_cluster(
2130 xfs_inode_t *free_ip, 2123 xfs_inode_t *free_ip,
@@ -3004,7 +2997,6 @@ xfs_iflush_cluster(
3004 int ilist_size; 2997 int ilist_size;
3005 xfs_inode_t **ilist; 2998 xfs_inode_t **ilist;
3006 xfs_inode_t *iq; 2999 xfs_inode_t *iq;
3007 xfs_inode_log_item_t *iip;
3008 int nr_found; 3000 int nr_found;
3009 int clcount = 0; 3001 int clcount = 0;
3010 int bufwasdelwri; 3002 int bufwasdelwri;
@@ -3040,13 +3032,8 @@ xfs_iflush_cluster(
3040 * is a candidate for flushing. These checks will be repeated 3032 * is a candidate for flushing. These checks will be repeated
3041 * later after the appropriate locks are acquired. 3033 * later after the appropriate locks are acquired.
3042 */ 3034 */
3043 iip = iq->i_itemp; 3035 if (xfs_inode_clean(iq) && xfs_ipincount(iq) == 0)
3044 if ((iq->i_update_core == 0) &&
3045 ((iip == NULL) ||
3046 !(iip->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
3047 xfs_ipincount(iq) == 0) {
3048 continue; 3036 continue;
3049 }
3050 3037
3051 /* 3038 /*
3052 * Try to get locks. If any are unavailable or it is pinned, 3039 * Try to get locks. If any are unavailable or it is pinned,
@@ -3069,10 +3056,8 @@ xfs_iflush_cluster(
3069 * arriving here means that this inode can be flushed. First 3056 * arriving here means that this inode can be flushed. First
3070 * re-check that it's dirty before flushing. 3057 * re-check that it's dirty before flushing.
3071 */ 3058 */
3072 iip = iq->i_itemp; 3059 if (!xfs_inode_clean(iq)) {
3073 if ((iq->i_update_core != 0) || ((iip != NULL) && 3060 int error;
3074 (iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
3075 int error;
3076 error = xfs_iflush_int(iq, bp); 3061 error = xfs_iflush_int(iq, bp);
3077 if (error) { 3062 if (error) {
3078 xfs_iunlock(iq, XFS_ILOCK_SHARED); 3063 xfs_iunlock(iq, XFS_ILOCK_SHARED);
@@ -3176,8 +3161,7 @@ xfs_iflush(
3176 * If the inode isn't dirty, then just release the inode 3161 * If the inode isn't dirty, then just release the inode
3177 * flush lock and do nothing. 3162 * flush lock and do nothing.
3178 */ 3163 */
3179 if ((ip->i_update_core == 0) && 3164 if (xfs_inode_clean(ip)) {
3180 ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
3181 ASSERT((iip != NULL) ? 3165 ASSERT((iip != NULL) ?
3182 !(iip->ili_item.li_flags & XFS_LI_IN_AIL) : 1); 3166 !(iip->ili_item.li_flags & XFS_LI_IN_AIL) : 1);
3183 xfs_ifunlock(ip); 3167 xfs_ifunlock(ip);
@@ -3343,8 +3327,7 @@ xfs_iflush_int(
3343 * If the inode isn't dirty, then just release the inode 3327 * If the inode isn't dirty, then just release the inode
3344 * flush lock and do nothing. 3328 * flush lock and do nothing.
3345 */ 3329 */
3346 if ((ip->i_update_core == 0) && 3330 if (xfs_inode_clean(ip)) {
3347 ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL))) {
3348 xfs_ifunlock(ip); 3331 xfs_ifunlock(ip);
3349 return 0; 3332 return 0;
3350 } 3333 }
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index bfe92ea17952..40513077ab36 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -168,6 +168,14 @@ static inline int xfs_ilog_fext(int w)
168 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); 168 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
169} 169}
170 170
171static inline int xfs_inode_clean(xfs_inode_t *ip)
172{
173 return (!ip->i_itemp ||
174 !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL)) &&
175 !ip->i_update_core;
176}
177
178
171#ifdef __KERNEL__ 179#ifdef __KERNEL__
172 180
173extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); 181extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 14140f6225ba..5390d124ad35 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3454,7 +3454,6 @@ xfs_inode_flush(
3454 int flags) 3454 int flags)
3455{ 3455{
3456 xfs_mount_t *mp = ip->i_mount; 3456 xfs_mount_t *mp = ip->i_mount;
3457 xfs_inode_log_item_t *iip = ip->i_itemp;
3458 int error = 0; 3457 int error = 0;
3459 3458
3460 if (XFS_FORCED_SHUTDOWN(mp)) 3459 if (XFS_FORCED_SHUTDOWN(mp))
@@ -3464,8 +3463,7 @@ xfs_inode_flush(
3464 * Bypass inodes which have already been cleaned by 3463 * Bypass inodes which have already been cleaned by
3465 * the inode flush clustering code inside xfs_iflush 3464 * the inode flush clustering code inside xfs_iflush
3466 */ 3465 */
3467 if ((ip->i_update_core == 0) && 3466 if (xfs_inode_clean(ip))
3468 ((iip == NULL) || !(iip->ili_format.ilf_fields & XFS_ILOG_ALL)))
3469 return 0; 3467 return 0;
3470 3468
3471 /* 3469 /*