From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/6] [XFS] Split inode data writeback from inode sync.
Date: Sun, 15 Mar 2009 22:46:38 +1100 [thread overview]
Message-ID: <1237117603-26071-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1237117603-26071-1-git-send-email-david@fromorbit.com>
In many cases we only want to sync inode data. Start
spliting the inode sync into data sync and inode sync
by factoring out the inode data flush.
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/linux-2.6/xfs_sync.c | 54 +++++++++++++++++++++++++++----------------
1 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index f7ba766..fd024e2 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -47,6 +47,37 @@
#include <linux/kthread.h>
#include <linux/freezer.h>
+static int
+xfs_sync_inode_data(
+ struct xfs_inode *ip,
+ int flags)
+{
+ struct inode *inode = VFS_I(ip);
+ int error = 0;
+
+ if (VN_DIRTY(inode)) {
+ int locked = 0;
+ if (flags & SYNC_TRYLOCK) {
+ if (xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED))
+ locked = 1;
+ } else {
+ xfs_ilock(ip, XFS_IOLOCK_SHARED);
+ locked = 1;
+ }
+ if (locked) {
+ error = xfs_flush_pages(ip, 0, -1,
+ (flags & SYNC_WAIT) ? 0 : XFS_B_ASYNC,
+ FI_NONE);
+ xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+ }
+ }
+
+ if (flags & SYNC_IOWAIT)
+ xfs_ioend_wait(ip);
+
+ return error;
+}
+
/*
* Sync all the inodes in the given AG according to the
* direction given by the flags.
@@ -122,27 +153,10 @@ xfs_sync_inodes_ag(
* If we have to flush data or wait for I/O completion
* we need to hold the iolock.
*/
- if (flags & SYNC_DELWRI) {
- if (VN_DIRTY(inode)) {
- if (flags & SYNC_TRYLOCK) {
- if (xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED))
- lock_flags |= XFS_IOLOCK_SHARED;
- } else {
- xfs_ilock(ip, XFS_IOLOCK_SHARED);
- lock_flags |= XFS_IOLOCK_SHARED;
- }
- if (lock_flags & XFS_IOLOCK_SHARED) {
- error = xfs_flush_pages(ip, 0, -1,
- (flags & SYNC_WAIT) ? 0
- : XFS_B_ASYNC,
- FI_NONE);
- }
- }
- if (VN_CACHED(inode) && (flags & SYNC_IOWAIT))
- xfs_ioend_wait(ip);
- }
- xfs_ilock(ip, XFS_ILOCK_SHARED);
+ 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);
--
1.6.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2009-03-15 15:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-15 11:46 [PATCH 0/6] [XFS] introduce a AG inode tree walker Dave Chinner
2009-03-15 11:46 ` Dave Chinner [this message]
2009-03-16 10:10 ` [PATCH 1/6] [XFS] Split inode data writeback from inode sync Christoph Hellwig
2009-03-16 10:47 ` Dave Chinner
2009-03-15 11:46 ` [PATCH 2/6] [XFS] Use xfs_inode_flush() in xfs_sync_inodes_ag() Dave Chinner
2009-03-15 11:46 ` [PATCH 3/6] [XFS] Factor out inode validation for sync Dave Chinner
2009-03-15 11:46 ` [PATCH 4/6] [XFS] Factor out inode validation for reclaim Dave Chinner
2009-03-15 11:46 ` [PATCH 5/6] [XFS] Remove unused parameter from xfs_reclaim_inodes Dave Chinner
2009-03-15 11:46 ` [PATCH 6/6] [XFS] introduce a per-ag inode iterator Dave Chinner
2009-03-16 7:53 ` [PATCH 0/6] [XFS] introduce a AG inode tree walker Christoph Hellwig
2009-03-16 9:40 ` Dave Chinner
2009-03-16 10:01 ` Christoph Hellwig
2009-03-16 10:35 ` Dave Chinner
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=1237117603-26071-2-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--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