aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c79
1 files changed, 34 insertions, 45 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index b5cdf0ef39ec..37fc2c0a4d25 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -39,6 +39,33 @@
39#include <linux/kthread.h> 39#include <linux/kthread.h>
40#include <linux/freezer.h> 40#include <linux/freezer.h>
41 41
42STATIC int
43xfs_inode_ag_walk_grab(
44 struct xfs_inode *ip)
45{
46 struct inode *inode = VFS_I(ip);
47
48 /* nothing to sync during shutdown */
49 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
50 return EFSCORRUPTED;
51
52 /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
53 if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
54 return ENOENT;
55
56 /* If we can't grab the inode, it must on it's way to reclaim. */
57 if (!igrab(inode))
58 return ENOENT;
59
60 if (is_bad_inode(inode)) {
61 IRELE(ip);
62 return ENOENT;
63 }
64
65 /* inode is valid */
66 return 0;
67}
68
42 69
43STATIC int 70STATIC int
44xfs_inode_ag_walk( 71xfs_inode_ag_walk(
@@ -80,8 +107,14 @@ restart:
80 if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino)) 107 if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino))
81 done = 1; 108 done = 1;
82 109
83 /* execute releases pag->pag_ici_lock */ 110 if (xfs_inode_ag_walk_grab(ip)) {
111 read_unlock(&pag->pag_ici_lock);
112 continue;
113 }
114 read_unlock(&pag->pag_ici_lock);
115
84 error = execute(ip, pag, flags); 116 error = execute(ip, pag, flags);
117 IRELE(ip);
85 if (error == EAGAIN) { 118 if (error == EAGAIN) {
86 skipped++; 119 skipped++;
87 continue; 120 continue;
@@ -128,40 +161,6 @@ xfs_inode_ag_iterator(
128 return XFS_ERROR(last_error); 161 return XFS_ERROR(last_error);
129} 162}
130 163
131/* must be called with pag_ici_lock held and releases it */
132int
133xfs_sync_inode_valid(
134 struct xfs_inode *ip,
135 struct xfs_perag *pag)
136{
137 struct inode *inode = VFS_I(ip);
138 int error = EFSCORRUPTED;
139
140 /* nothing to sync during shutdown */
141 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
142 goto out_unlock;
143
144 /* avoid new or reclaimable inodes. Leave for reclaim code to flush */
145 error = ENOENT;
146 if (xfs_iflags_test(ip, XFS_INEW | XFS_IRECLAIMABLE | XFS_IRECLAIM))
147 goto out_unlock;
148
149 /* If we can't grab the inode, it must on it's way to reclaim. */
150 if (!igrab(inode))
151 goto out_unlock;
152
153 if (is_bad_inode(inode)) {
154 IRELE(ip);
155 goto out_unlock;
156 }
157
158 /* inode is valid */
159 error = 0;
160out_unlock:
161 read_unlock(&pag->pag_ici_lock);
162 return error;
163}
164
165STATIC int 164STATIC int
166xfs_sync_inode_data( 165xfs_sync_inode_data(
167 struct xfs_inode *ip, 166 struct xfs_inode *ip,
@@ -172,10 +171,6 @@ xfs_sync_inode_data(
172 struct address_space *mapping = inode->i_mapping; 171 struct address_space *mapping = inode->i_mapping;
173 int error = 0; 172 int error = 0;
174 173
175 error = xfs_sync_inode_valid(ip, pag);
176 if (error)
177 return error;
178
179 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) 174 if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
180 goto out_wait; 175 goto out_wait;
181 176
@@ -192,7 +187,6 @@ xfs_sync_inode_data(
192 out_wait: 187 out_wait:
193 if (flags & SYNC_WAIT) 188 if (flags & SYNC_WAIT)
194 xfs_ioend_wait(ip); 189 xfs_ioend_wait(ip);
195 IRELE(ip);
196 return error; 190 return error;
197} 191}
198 192
@@ -204,10 +198,6 @@ xfs_sync_inode_attr(
204{ 198{
205 int error = 0; 199 int error = 0;
206 200
207 error = xfs_sync_inode_valid(ip, pag);
208 if (error)
209 return error;
210
211 xfs_ilock(ip, XFS_ILOCK_SHARED); 201 xfs_ilock(ip, XFS_ILOCK_SHARED);
212 if (xfs_inode_clean(ip)) 202 if (xfs_inode_clean(ip))
213 goto out_unlock; 203 goto out_unlock;
@@ -226,7 +216,6 @@ xfs_sync_inode_attr(
226 216
227 out_unlock: 217 out_unlock:
228 xfs_iunlock(ip, XFS_ILOCK_SHARED); 218 xfs_iunlock(ip, XFS_ILOCK_SHARED);
229 IRELE(ip);
230 return error; 219 return error;
231} 220}
232 221