public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH 2/7] xfs: split inode flushing from xfs_sync_inodes_ag
Date: Wed, 27 May 2009 06:58:41 -0400	[thread overview]
Message-ID: <20090527105841.GA10545@infradead.org> (raw)
In-Reply-To: <4A1C54FB.2080705@sandeen.net>

On Tue, May 26, 2009 at 03:45:47PM -0500, Eric Sandeen wrote:
> What happened to the XFS_IFLUSH_DELWRI case?
> 
> You mentioned "keep the current behavior exactly" but this seems like a
> change, no?

Yeah, this got lost when playing with variations of the patch.  Correct
version below:

Subject: xfs: split inode flushing from xfs_sync_inodes_ag
From: Christoph Hellwig <hch@lst.de>


In many cases we only want to sync inode metadata. Split out the inode
flushing into a separate helper to prepare factoring the inode sync code.

Based on a patch from Dave Chinner, but redone to keep the current behaviour
exactly and leave changes to the flushing logic to another patch.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/linux-2.6/xfs_sync.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c	2009-05-27 12:08:49.137850883 +0200
+++ xfs/fs/xfs/linux-2.6/xfs_sync.c	2009-05-27 12:11:09.530815659 +0200
@@ -77,6 +77,35 @@ xfs_sync_inode_data(
 	return error;
 }
 
+STATIC int
+xfs_sync_inode_attr(
+	struct xfs_inode	*ip,
+	int			flags)
+{
+	int			error = 0;
+
+	xfs_ilock(ip, XFS_ILOCK_SHARED);
+	if (xfs_inode_clean(ip))
+		goto out_unlock;
+	if (!xfs_iflock_nowait(ip)) {
+		if (!(flags & SYNC_WAIT))
+			goto out_unlock;
+		xfs_iflock(ip);
+	}
+
+	if (xfs_inode_clean(ip)) {
+		xfs_ifunlock(ip);
+		goto out_unlock;
+	}
+
+	error = xfs_iflush(ip, (flags & SYNC_WAIT) ?
+			   XFS_IFLUSH_SYNC : XFS_IFLUSH_DELWRI);
+
+ out_unlock:
+	xfs_iunlock(ip, XFS_ILOCK_SHARED);
+	return error;
+}
+
 /*
  * Sync all the inodes in the given AG according to the
  * direction given by the flags.
@@ -96,7 +125,6 @@ xfs_sync_inodes_ag(
 	do {
 		struct inode	*inode;
 		xfs_inode_t	*ip = NULL;
-		int		lock_flags = XFS_ILOCK_SHARED;
 
 		/*
 		 * use a gang lookup to find the next inode in the tree
@@ -155,22 +183,10 @@ xfs_sync_inodes_ag(
 		if (flags & SYNC_DELWRI)
 			error = xfs_sync_inode_data(ip, flags);
 
-		xfs_ilock(ip, XFS_ILOCK_SHARED);
-		if ((flags & SYNC_ATTR) && !xfs_inode_clean(ip)) {
-			if (flags & SYNC_WAIT) {
-				xfs_iflock(ip);
-				if (!xfs_inode_clean(ip))
-					error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
-				else
-					xfs_ifunlock(ip);
-			} else if (xfs_iflock_nowait(ip)) {
-				if (!xfs_inode_clean(ip))
-					error = xfs_iflush(ip, XFS_IFLUSH_DELWRI);
-				else
-					xfs_ifunlock(ip);
-			}
-		}
-		xfs_iput(ip, lock_flags);
+		if (flags & SYNC_ATTR)
+			error = xfs_sync_inode_attr(ip, flags);
+
+		IRELE(ip);
 
 		if (error)
 			last_error = error;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2009-05-27 10:58 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 17:12 [PATCH 0/7] inode sync refactoring Christoph Hellwig
2009-05-14 17:12 ` [PATCH 1/7] xfs: split inode data writeback from xfs_sync_inodes_ag Christoph Hellwig
2009-05-15  4:49   ` Sujit Karataparambil
2009-05-15 17:21     ` Christoph Hellwig
2009-05-18  6:58       ` Dave Chinner
2009-05-26 20:14   ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 2/7] xfs: split inode flushing " Christoph Hellwig
2009-05-15  4:52   ` Sujit Karataparambil
2009-05-15 17:22     ` Christoph Hellwig
2009-05-26 20:45   ` Eric Sandeen
2009-05-27 10:58     ` Christoph Hellwig [this message]
2009-05-27 20:11       ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 3/7] xfs: factor out inode validation for sync Christoph Hellwig
2009-05-27 20:38   ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 4/7] xfs: remove unused parameter from xfs_reclaim_inodes Christoph Hellwig
2009-05-27 20:44   ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 5/7] xfs: introduce a per-ag inode iterator Christoph Hellwig
2009-06-03 22:01   ` Eric Sandeen
2009-06-04 11:00     ` Christoph Hellwig
2009-06-03 22:18   ` Eric Sandeen
2009-06-04 17:17     ` Christoph Hellwig
2009-06-05 18:18       ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 6/7] xfs: use generic inode iterator in xfs_qm_dqrele_all_inodes Christoph Hellwig
2009-06-03 23:29   ` Josef 'Jeff' Sipek
2009-06-05 19:15   ` Eric Sandeen
2009-06-05 19:17     ` Christoph Hellwig
2009-06-05 20:11       ` Eric Sandeen
2009-05-14 17:12 ` [PATCH 7/7] xfs: split xfs_sync_inodes Christoph Hellwig
2009-06-03 23:26   ` Josef 'Jeff' Sipek
2009-06-04 10:45     ` Christoph Hellwig
2009-06-05 20:32   ` Eric Sandeen
2009-05-28 12:19 ` [PATCH 8/7] xfs: remove SYNC_IOWAIT Christoph Hellwig
2009-06-03 23:30   ` Josef 'Jeff' Sipek
2009-06-04 10:46     ` Christoph Hellwig
2009-06-05 20:37   ` Eric Sandeen
2009-05-28 12:19 ` [PATCH 9/7] xfs: remove SYNC_BDFLUSH Christoph Hellwig
2009-05-29 13:19   ` Sujit Karataparambil
2009-05-29 20:10     ` Christoph Hellwig
2009-05-30  8:27       ` Sujit Karataparambil
2009-06-05 20:45   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527105841.GA10545@infradead.org \
    --to=hch@infradead.org \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox