aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_sync.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index 7adc62dd14bb..1712caa12017 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -77,6 +77,35 @@ xfs_sync_inode_data(
77 return error; 77 return error;
78} 78}
79 79
80STATIC int
81xfs_sync_inode_attr(
82 struct xfs_inode *ip,
83 int flags)
84{
85 int error = 0;
86
87 xfs_ilock(ip, XFS_ILOCK_SHARED);
88 if (xfs_inode_clean(ip))
89 goto out_unlock;
90 if (!xfs_iflock_nowait(ip)) {
91 if (!(flags & SYNC_WAIT))
92 goto out_unlock;
93 xfs_iflock(ip);
94 }
95
96 if (xfs_inode_clean(ip)) {
97 xfs_ifunlock(ip);
98 goto out_unlock;
99 }
100
101 error = xfs_iflush(ip, (flags & SYNC_WAIT) ?
102 XFS_IFLUSH_SYNC : XFS_IFLUSH_DELWRI);
103
104 out_unlock:
105 xfs_iunlock(ip, XFS_ILOCK_SHARED);
106 return error;
107}
108
80/* 109/*
81 * Sync all the inodes in the given AG according to the 110 * Sync all the inodes in the given AG according to the
82 * direction given by the flags. 111 * direction given by the flags.
@@ -96,7 +125,6 @@ xfs_sync_inodes_ag(
96 do { 125 do {
97 struct inode *inode; 126 struct inode *inode;
98 xfs_inode_t *ip = NULL; 127 xfs_inode_t *ip = NULL;
99 int lock_flags = XFS_ILOCK_SHARED;
100 128
101 /* 129 /*
102 * use a gang lookup to find the next inode in the tree 130 * use a gang lookup to find the next inode in the tree
@@ -155,22 +183,10 @@ xfs_sync_inodes_ag(
155 if (flags & SYNC_DELWRI) 183 if (flags & SYNC_DELWRI)
156 error = xfs_sync_inode_data(ip, flags); 184 error = xfs_sync_inode_data(ip, flags);
157 185
158 xfs_ilock(ip, XFS_ILOCK_SHARED); 186 if (flags & SYNC_ATTR)
159 if ((flags & SYNC_ATTR) && !xfs_inode_clean(ip)) { 187 error = xfs_sync_inode_attr(ip, flags);
160 if (flags & SYNC_WAIT) { 188
161 xfs_iflock(ip); 189 IRELE(ip);
162 if (!xfs_inode_clean(ip))
163 error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
164 else
165 xfs_ifunlock(ip);
166 } else if (xfs_iflock_nowait(ip)) {
167 if (!xfs_inode_clean(ip))
168 error = xfs_iflush(ip, XFS_IFLUSH_DELWRI);
169 else
170 xfs_ifunlock(ip);
171 }
172 }
173 xfs_iput(ip, lock_flags);
174 190
175 if (error) 191 if (error)
176 last_error = error; 192 last_error = error;