public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Use xfs_inode_clean() in more places
@ 2008-01-21  5:16 David Chinner
  2008-02-14 23:52 ` David Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: David Chinner @ 2008-01-21  5:16 UTC (permalink / raw)
  To: xfs-dev; +Cc: xfs-oss

Use xfs_inode_clean() in more places.

Version 2:
- remove eye-hurting STATIC_INLINE
- make check less verbose

Signed-off-by: Dave Chinner <dgc@sgi.com>
---
 fs/xfs/xfs_inode.c      |   27 +++++----------------------
 fs/xfs/xfs_inode_item.h |    8 ++++++++
 fs/xfs/xfs_vnodeops.c   |    4 +---
 3 files changed, 14 insertions(+), 25 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c	2008-01-21 16:06:27.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c	2008-01-21 16:08:47.893673473 +1100
@@ -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;
@@ -3038,13 +3030,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,
@@ -3067,10 +3054,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);
@@ -3174,8 +3159,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);
@@ -3341,8 +3325,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: 2.6.x-xfs-new/fs/xfs/xfs_vnodeops.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_vnodeops.c	2008-01-21 16:06:27.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_vnodeops.c	2008-01-21 16:08:47.897672964 +1100
@@ -3490,7 +3490,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))
@@ -3500,8 +3499,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;
 
 	/*
Index: 2.6.x-xfs-new/fs/xfs/xfs_inode_item.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode_item.h	2008-01-21 16:06:27.000000000 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_inode_item.h	2008-01-21 16:14:34.001674576 +1100
@@ -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 *);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Use xfs_inode_clean() in more places
  2008-01-21  5:16 [patch] Use xfs_inode_clean() in more places David Chinner
@ 2008-02-14 23:52 ` David Chinner
  2008-02-15  4:23   ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: David Chinner @ 2008-02-14 23:52 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-dev, xfs-oss

ping?

On Mon, Jan 21, 2008 at 04:16:47PM +1100, David Chinner wrote:
> Use xfs_inode_clean() in more places.
> 
> Version 2:
> - remove eye-hurting STATIC_INLINE
> - make check less verbose
> 
> Signed-off-by: Dave Chinner <dgc@sgi.com>
> ---
>  fs/xfs/xfs_inode.c      |   27 +++++----------------------
>  fs/xfs/xfs_inode_item.h |    8 ++++++++
>  fs/xfs/xfs_vnodeops.c   |    4 +---
>  3 files changed, 14 insertions(+), 25 deletions(-)
> 
> Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c	2008-01-21 16:06:27.000000000 +1100
> +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c	2008-01-21 16:08:47.893673473 +1100
> @@ -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;
> @@ -3038,13 +3030,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,
> @@ -3067,10 +3054,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);
> @@ -3174,8 +3159,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);
> @@ -3341,8 +3325,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: 2.6.x-xfs-new/fs/xfs/xfs_vnodeops.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_vnodeops.c	2008-01-21 16:06:27.000000000 +1100
> +++ 2.6.x-xfs-new/fs/xfs/xfs_vnodeops.c	2008-01-21 16:08:47.897672964 +1100
> @@ -3490,7 +3490,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))
> @@ -3500,8 +3499,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;
>  
>  	/*
> Index: 2.6.x-xfs-new/fs/xfs/xfs_inode_item.h
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode_item.h	2008-01-21 16:06:27.000000000 +1100
> +++ 2.6.x-xfs-new/fs/xfs/xfs_inode_item.h	2008-01-21 16:14:34.001674576 +1100
> @@ -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 *);

-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Use xfs_inode_clean() in more places
  2008-02-14 23:52 ` David Chinner
@ 2008-02-15  4:23   ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2008-02-15  4:23 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-dev, xfs-oss

On Fri, Feb 15, 2008 at 10:52:59AM +1100, David Chinner wrote:
> ping?

Looks good.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-15  4:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21  5:16 [patch] Use xfs_inode_clean() in more places David Chinner
2008-02-14 23:52 ` David Chinner
2008-02-15  4:23   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox