diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-28 21:44:37 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:37:29 -0400 |
commit | b3aea4edc2903fdee34920630b8b2433f6452f02 (patch) | |
tree | 9d9e93c4dac6dc5a30522e0c2ae051e3aad46b1b /fs/xfs | |
parent | 2f6f7b3d9b5600e1f6e7622c62ab30f36bd0f57f (diff) |
[XFS] kill the v_flag member in struct bhv_vnode
All flags previously handled at the vnode level are not in the xfs_inode
where we already have a flags mechanisms and free bits for flags
previously in the vnode.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29495a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 11 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 10 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_fs_subr.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 6 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 9 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 42 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 12 |
11 files changed, 33 insertions, 79 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 28ccca98839b..22a40bd0cce2 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -304,13 +304,13 @@ xfs_map_blocks( | |||
304 | xfs_iomap_t *mapp, | 304 | xfs_iomap_t *mapp, |
305 | int flags) | 305 | int flags) |
306 | { | 306 | { |
307 | bhv_vnode_t *vp = vn_from_inode(inode); | 307 | xfs_inode_t *ip = XFS_I(inode); |
308 | int error, nmaps = 1; | 308 | int error, nmaps = 1; |
309 | 309 | ||
310 | error = xfs_bmap(xfs_vtoi(vp), offset, count, | 310 | error = xfs_bmap(ip, offset, count, |
311 | flags, mapp, &nmaps); | 311 | flags, mapp, &nmaps); |
312 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) | 312 | if (!error && (flags & (BMAPI_WRITE|BMAPI_ALLOCATE))) |
313 | VMODIFY(vp); | 313 | xfs_iflags_set(ip, XFS_IMODIFIED); |
314 | return -error; | 314 | return -error; |
315 | } | 315 | } |
316 | 316 | ||
@@ -1246,10 +1246,7 @@ xfs_vm_writepages( | |||
1246 | struct address_space *mapping, | 1246 | struct address_space *mapping, |
1247 | struct writeback_control *wbc) | 1247 | struct writeback_control *wbc) |
1248 | { | 1248 | { |
1249 | struct bhv_vnode *vp = vn_from_inode(mapping->host); | 1249 | xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED); |
1250 | |||
1251 | if (VN_TRUNC(vp)) | ||
1252 | VUNTRUNCATE(vp); | ||
1253 | return generic_writepages(mapping, wbc); | 1250 | return generic_writepages(mapping, wbc); |
1254 | } | 1251 | } |
1255 | 1252 | ||
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 1d72dbb1a73d..123659e74b53 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -193,13 +193,11 @@ xfs_file_fsync( | |||
193 | struct dentry *dentry, | 193 | struct dentry *dentry, |
194 | int datasync) | 194 | int datasync) |
195 | { | 195 | { |
196 | bhv_vnode_t *vp = vn_from_inode(dentry->d_inode); | ||
197 | int flags = FSYNC_WAIT; | 196 | int flags = FSYNC_WAIT; |
198 | 197 | ||
199 | if (datasync) | 198 | if (datasync) |
200 | flags |= FSYNC_DATA; | 199 | flags |= FSYNC_DATA; |
201 | if (VN_TRUNC(vp)) | 200 | xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED); |
202 | VUNTRUNCATE(vp); | ||
203 | return -xfs_fsync(XFS_I(dentry->d_inode), flags, | 201 | return -xfs_fsync(XFS_I(dentry->d_inode), flags, |
204 | (xfs_off_t)0, (xfs_off_t)-1); | 202 | (xfs_off_t)0, (xfs_off_t)-1); |
205 | } | 203 | } |
@@ -277,10 +275,9 @@ xfs_file_ioctl( | |||
277 | { | 275 | { |
278 | int error; | 276 | int error; |
279 | struct inode *inode = filp->f_path.dentry->d_inode; | 277 | struct inode *inode = filp->f_path.dentry->d_inode; |
280 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
281 | 278 | ||
282 | error = xfs_ioctl(XFS_I(inode), filp, 0, cmd, (void __user *)p); | 279 | error = xfs_ioctl(XFS_I(inode), filp, 0, cmd, (void __user *)p); |
283 | VMODIFY(vp); | 280 | xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED); |
284 | 281 | ||
285 | /* NOTE: some of the ioctl's return positive #'s as a | 282 | /* NOTE: some of the ioctl's return positive #'s as a |
286 | * byte count indicating success, such as | 283 | * byte count indicating success, such as |
@@ -299,10 +296,9 @@ xfs_file_ioctl_invis( | |||
299 | { | 296 | { |
300 | int error; | 297 | int error; |
301 | struct inode *inode = filp->f_path.dentry->d_inode; | 298 | struct inode *inode = filp->f_path.dentry->d_inode; |
302 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
303 | 299 | ||
304 | error = xfs_ioctl(XFS_I(inode), filp, IO_INVIS, cmd, (void __user *)p); | 300 | error = xfs_ioctl(XFS_I(inode), filp, IO_INVIS, cmd, (void __user *)p); |
305 | VMODIFY(vp); | 301 | xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED); |
306 | 302 | ||
307 | /* NOTE: some of the ioctl's return positive #'s as a | 303 | /* NOTE: some of the ioctl's return positive #'s as a |
308 | * byte count indicating success, such as | 304 | * byte count indicating success, such as |
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c index e2897912fec7..ac6d34cc355d 100644 --- a/fs/xfs/linux-2.6/xfs_fs_subr.c +++ b/fs/xfs/linux-2.6/xfs_fs_subr.c | |||
@@ -61,8 +61,7 @@ xfs_flushinval_pages( | |||
61 | int ret = 0; | 61 | int ret = 0; |
62 | 62 | ||
63 | if (VN_CACHED(vp)) { | 63 | if (VN_CACHED(vp)) { |
64 | if (VN_TRUNC(vp)) | 64 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
65 | VUNTRUNCATE(vp); | ||
66 | ret = filemap_write_and_wait(inode->i_mapping); | 65 | ret = filemap_write_and_wait(inode->i_mapping); |
67 | if (!ret) | 66 | if (!ret) |
68 | truncate_inode_pages(inode->i_mapping, first); | 67 | truncate_inode_pages(inode->i_mapping, first); |
@@ -84,8 +83,7 @@ xfs_flush_pages( | |||
84 | int ret2; | 83 | int ret2; |
85 | 84 | ||
86 | if (VN_DIRTY(vp)) { | 85 | if (VN_DIRTY(vp)) { |
87 | if (VN_TRUNC(vp)) | 86 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
88 | VUNTRUNCATE(vp); | ||
89 | ret = filemap_fdatawrite(inode->i_mapping); | 87 | ret = filemap_fdatawrite(inode->i_mapping); |
90 | if (flags & XFS_B_ASYNC) | 88 | if (flags & XFS_B_ASYNC) |
91 | return ret; | 89 | return ret; |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 83f509960305..0046bdd5b7f1 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -371,7 +371,6 @@ xfs_compat_ioctl( | |||
371 | unsigned long arg) | 371 | unsigned long arg) |
372 | { | 372 | { |
373 | struct inode *inode = file->f_path.dentry->d_inode; | 373 | struct inode *inode = file->f_path.dentry->d_inode; |
374 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
375 | int error; | 374 | int error; |
376 | 375 | ||
377 | switch (cmd) { | 376 | switch (cmd) { |
@@ -459,7 +458,7 @@ xfs_compat_ioctl( | |||
459 | } | 458 | } |
460 | 459 | ||
461 | error = xfs_ioctl(XFS_I(inode), file, mode, cmd, (void __user *)arg); | 460 | error = xfs_ioctl(XFS_I(inode), file, mode, cmd, (void __user *)arg); |
462 | VMODIFY(vp); | 461 | xfs_iflags_set(XFS_I(inode), XFS_IMODIFIED); |
463 | 462 | ||
464 | return error; | 463 | return error; |
465 | } | 464 | } |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 4da034f4ae14..98d5a7e13bd5 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -221,7 +221,7 @@ xfs_init_security( | |||
221 | error = xfs_attr_set(XFS_I(ip), name, value, | 221 | error = xfs_attr_set(XFS_I(ip), name, value, |
222 | length, ATTR_SECURE); | 222 | length, ATTR_SECURE); |
223 | if (!error) | 223 | if (!error) |
224 | VMODIFY(vp); | 224 | xfs_iflags_set(XFS_I(ip), XFS_IMODIFIED); |
225 | 225 | ||
226 | kfree(name); | 226 | kfree(name); |
227 | kfree(value); | 227 | kfree(value); |
@@ -327,7 +327,7 @@ xfs_vn_mknod( | |||
327 | if (!error) { | 327 | if (!error) { |
328 | error = _ACL_INHERIT(vp, &vattr, default_acl); | 328 | error = _ACL_INHERIT(vp, &vattr, default_acl); |
329 | if (!error) | 329 | if (!error) |
330 | VMODIFY(vp); | 330 | xfs_iflags_set(XFS_I(&vp->v_inode), XFS_IMODIFIED); |
331 | else | 331 | else |
332 | xfs_cleanup_inode(dir, vp, dentry, mode); | 332 | xfs_cleanup_inode(dir, vp, dentry, mode); |
333 | } | 333 | } |
@@ -409,7 +409,7 @@ xfs_vn_link( | |||
409 | if (unlikely(error)) { | 409 | if (unlikely(error)) { |
410 | VN_RELE(vp); | 410 | VN_RELE(vp); |
411 | } else { | 411 | } else { |
412 | VMODIFY(vn_from_inode(dir)); | 412 | xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); |
413 | xfs_validate_fields(ip, &vattr); | 413 | xfs_validate_fields(ip, &vattr); |
414 | d_instantiate(dentry, ip); | 414 | d_instantiate(dentry, ip); |
415 | } | 415 | } |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 650c24ab27e2..47bca4e4696b 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -197,7 +197,7 @@ xfs_revalidate_inode( | |||
197 | inode->i_flags |= S_NOATIME; | 197 | inode->i_flags |= S_NOATIME; |
198 | else | 198 | else |
199 | inode->i_flags &= ~S_NOATIME; | 199 | inode->i_flags &= ~S_NOATIME; |
200 | vp->v_flag &= ~VMODIFIED; | 200 | xfs_iflags_clear(ip, XFS_IMODIFIED); |
201 | } | 201 | } |
202 | 202 | ||
203 | void | 203 | void |
@@ -441,13 +441,12 @@ xfs_fs_clear_inode( | |||
441 | if (XFS_I(inode)) | 441 | if (XFS_I(inode)) |
442 | xfs_inactive(XFS_I(inode)); | 442 | xfs_inactive(XFS_I(inode)); |
443 | 443 | ||
444 | VN_LOCK(vp); | ||
445 | vp->v_flag &= ~VMODIFIED; | ||
446 | VN_UNLOCK(vp, 0); | ||
447 | 444 | ||
448 | if (XFS_I(inode)) | 445 | if (XFS_I(inode)) { |
446 | xfs_iflags_clear(XFS_I(inode), XFS_IMODIFIED); | ||
449 | if (xfs_reclaim(XFS_I(inode))) | 447 | if (xfs_reclaim(XFS_I(inode))) |
450 | panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp); | 448 | panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp); |
449 | } | ||
451 | 450 | ||
452 | ASSERT(XFS_I(inode) == NULL); | 451 | ASSERT(XFS_I(inode) == NULL); |
453 | 452 | ||
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index 342c57879901..e6c559aee446 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
@@ -84,9 +84,6 @@ vn_initialize( | |||
84 | XFS_STATS_INC(vn_active); | 84 | XFS_STATS_INC(vn_active); |
85 | XFS_STATS_INC(vn_alloc); | 85 | XFS_STATS_INC(vn_alloc); |
86 | 86 | ||
87 | vp->v_flag = VMODIFIED; | ||
88 | spinlock_init(&vp->v_lock, "v_lock"); | ||
89 | |||
90 | spin_lock(&vnumber_lock); | 87 | spin_lock(&vnumber_lock); |
91 | if (!++vn_generation) /* v_number shouldn't be zero */ | 88 | if (!++vn_generation) /* v_number shouldn't be zero */ |
92 | vn_generation++; | 89 | vn_generation++; |
@@ -157,7 +154,7 @@ __vn_revalidate( | |||
157 | error = xfs_getattr(xfs_vtoi(vp), vattr, 0); | 154 | error = xfs_getattr(xfs_vtoi(vp), vattr, 0); |
158 | if (likely(!error)) { | 155 | if (likely(!error)) { |
159 | vn_revalidate_core(vp, vattr); | 156 | vn_revalidate_core(vp, vattr); |
160 | VUNMODIFY(vp); | 157 | xfs_iflags_clear(xfs_vtoi(vp), XFS_IMODIFIED); |
161 | } | 158 | } |
162 | return -error; | 159 | return -error; |
163 | } | 160 | } |
@@ -182,10 +179,8 @@ vn_hold( | |||
182 | 179 | ||
183 | XFS_STATS_INC(vn_hold); | 180 | XFS_STATS_INC(vn_hold); |
184 | 181 | ||
185 | VN_LOCK(vp); | ||
186 | inode = igrab(vn_to_inode(vp)); | 182 | inode = igrab(vn_to_inode(vp)); |
187 | ASSERT(inode); | 183 | ASSERT(inode); |
188 | VN_UNLOCK(vp, 0); | ||
189 | 184 | ||
190 | return vp; | 185 | return vp; |
191 | } | 186 | } |
@@ -199,7 +194,7 @@ vn_hold( | |||
199 | /* 2 */ (void *)(__psint_t) line, \ | 194 | /* 2 */ (void *)(__psint_t) line, \ |
200 | /* 3 */ (void *)(__psint_t)(vn_count(vp)), \ | 195 | /* 3 */ (void *)(__psint_t)(vn_count(vp)), \ |
201 | /* 4 */ (void *)(ra), \ | 196 | /* 4 */ (void *)(ra), \ |
202 | /* 5 */ (void *)(__psunsigned_t)(vp)->v_flag, \ | 197 | /* 5 */ NULL, \ |
203 | /* 6 */ (void *)(__psint_t)current_cpu(), \ | 198 | /* 6 */ (void *)(__psint_t)current_cpu(), \ |
204 | /* 7 */ (void *)(__psint_t)current_pid(), \ | 199 | /* 7 */ (void *)(__psint_t)current_pid(), \ |
205 | /* 8 */ (void *)__return_address, \ | 200 | /* 8 */ (void *)__return_address, \ |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index 0f9ba6585c86..c8af208a73dc 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -27,20 +27,8 @@ struct attrlist_cursor_kern; | |||
27 | typedef struct dentry bhv_vname_t; | 27 | typedef struct dentry bhv_vname_t; |
28 | typedef __u64 bhv_vnumber_t; | 28 | typedef __u64 bhv_vnumber_t; |
29 | 29 | ||
30 | typedef enum bhv_vflags { | ||
31 | VMODIFIED = 0x08, /* XFS inode state possibly differs */ | ||
32 | /* to the Linux inode state. */ | ||
33 | VTRUNCATED = 0x40, /* truncated down so flush-on-close */ | ||
34 | } bhv_vflags_t; | ||
35 | |||
36 | /* | ||
37 | * MP locking protocols: | ||
38 | * v_flag, VN_LOCK/VN_UNLOCK | ||
39 | */ | ||
40 | typedef struct bhv_vnode { | 30 | typedef struct bhv_vnode { |
41 | bhv_vflags_t v_flag; /* vnode flags (see above) */ | ||
42 | bhv_vnumber_t v_number; /* in-core vnode number */ | 31 | bhv_vnumber_t v_number; /* in-core vnode number */ |
43 | spinlock_t v_lock; /* VN_LOCK/VN_UNLOCK */ | ||
44 | atomic_t v_iocount; /* outstanding I/O count */ | 32 | atomic_t v_iocount; /* outstanding I/O count */ |
45 | #ifdef XFS_VNODE_TRACE | 33 | #ifdef XFS_VNODE_TRACE |
46 | struct ktrace *v_trace; /* trace header structure */ | 34 | struct ktrace *v_trace; /* trace header structure */ |
@@ -255,35 +243,6 @@ static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp) | |||
255 | #define VNAME_TO_VNODE(dentry) (vn_from_inode((dentry)->d_inode)) | 243 | #define VNAME_TO_VNODE(dentry) (vn_from_inode((dentry)->d_inode)) |
256 | 244 | ||
257 | /* | 245 | /* |
258 | * Vnode spinlock manipulation. | ||
259 | */ | ||
260 | #define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) | ||
261 | #define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) | ||
262 | |||
263 | STATIC_INLINE void vn_flagset(struct bhv_vnode *vp, uint flag) | ||
264 | { | ||
265 | spin_lock(&vp->v_lock); | ||
266 | vp->v_flag |= flag; | ||
267 | spin_unlock(&vp->v_lock); | ||
268 | } | ||
269 | |||
270 | STATIC_INLINE uint vn_flagclr(struct bhv_vnode *vp, uint flag) | ||
271 | { | ||
272 | uint cleared; | ||
273 | |||
274 | spin_lock(&vp->v_lock); | ||
275 | cleared = (vp->v_flag & flag); | ||
276 | vp->v_flag &= ~flag; | ||
277 | spin_unlock(&vp->v_lock); | ||
278 | return cleared; | ||
279 | } | ||
280 | |||
281 | #define VMODIFY(vp) vn_flagset(vp, VMODIFIED) | ||
282 | #define VUNMODIFY(vp) vn_flagclr(vp, VMODIFIED) | ||
283 | #define VTRUNCATE(vp) vn_flagset(vp, VTRUNCATED) | ||
284 | #define VUNTRUNCATE(vp) vn_flagclr(vp, VTRUNCATED) | ||
285 | |||
286 | /* | ||
287 | * Dealing with bad inodes | 246 | * Dealing with bad inodes |
288 | */ | 247 | */ |
289 | static inline void vn_mark_bad(struct bhv_vnode *vp) | 248 | static inline void vn_mark_bad(struct bhv_vnode *vp) |
@@ -322,7 +281,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) | |||
322 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) | 281 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) |
323 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ | 282 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ |
324 | PAGECACHE_TAG_DIRTY) | 283 | PAGECACHE_TAG_DIRTY) |
325 | #define VN_TRUNC(vp) ((vp)->v_flag & VTRUNCATED) | ||
326 | 284 | ||
327 | /* | 285 | /* |
328 | * Flags to vop_setattr/getattr. | 286 | * Flags to vop_setattr/getattr. |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 5806597b9ec4..ee13d6d708c8 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -336,6 +336,7 @@ finish_inode: | |||
336 | ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) == | 336 | ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) == |
337 | ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0)); | 337 | ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0)); |
338 | 338 | ||
339 | xfs_iflags_set(ip, XFS_IMODIFIED); | ||
339 | *ipp = ip; | 340 | *ipp = ip; |
340 | 341 | ||
341 | /* | 342 | /* |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 6f88ac3b10ae..79d724615c39 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -391,6 +391,9 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags) | |||
391 | #define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ | 391 | #define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ |
392 | #define XFS_INEW 0x0040 | 392 | #define XFS_INEW 0x0040 |
393 | #define XFS_IFILESTREAM 0x0080 /* inode is in a filestream directory */ | 393 | #define XFS_IFILESTREAM 0x0080 /* inode is in a filestream directory */ |
394 | #define XFS_IMODIFIED 0x0100 /* XFS inode state possibly differs */ | ||
395 | /* to the Linux inode state. */ | ||
396 | #define XFS_ITRUNCATED 0x0200 /* truncated down so flush-on-close */ | ||
394 | 397 | ||
395 | /* | 398 | /* |
396 | * Flags for inode locking. | 399 | * Flags for inode locking. |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 7ebbfa0c4f0f..f2c037a9564e 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -660,7 +660,7 @@ xfs_setattr( | |||
660 | * vnode and flush it when the file is closed, and | 660 | * vnode and flush it when the file is closed, and |
661 | * do not wait the usual (long) time for writeout. | 661 | * do not wait the usual (long) time for writeout. |
662 | */ | 662 | */ |
663 | VTRUNCATE(vp); | 663 | xfs_iflags_set(ip, XFS_ITRUNCATED); |
664 | } | 664 | } |
665 | /* | 665 | /* |
666 | * Have to do this even if the file's size doesn't change. | 666 | * Have to do this even if the file's size doesn't change. |
@@ -1519,6 +1519,8 @@ xfs_release( | |||
1519 | return 0; | 1519 | return 0; |
1520 | 1520 | ||
1521 | if (!XFS_FORCED_SHUTDOWN(mp)) { | 1521 | if (!XFS_FORCED_SHUTDOWN(mp)) { |
1522 | int truncated; | ||
1523 | |||
1522 | /* | 1524 | /* |
1523 | * If we are using filestreams, and we have an unlinked | 1525 | * If we are using filestreams, and we have an unlinked |
1524 | * file that we are processing the last close on, then nothing | 1526 | * file that we are processing the last close on, then nothing |
@@ -1539,7 +1541,13 @@ xfs_release( | |||
1539 | * significantly reducing the time window where we'd otherwise | 1541 | * significantly reducing the time window where we'd otherwise |
1540 | * be exposed to that problem. | 1542 | * be exposed to that problem. |
1541 | */ | 1543 | */ |
1542 | if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0) | 1544 | spin_lock(&ip->i_flags_lock); |
1545 | truncated = __xfs_iflags_test(ip, XFS_ITRUNCATED); | ||
1546 | if (truncated) | ||
1547 | ip->i_flags &= ~XFS_ITRUNCATED; | ||
1548 | spin_unlock(&ip->i_flags_lock); | ||
1549 | |||
1550 | if (truncated && VN_DIRTY(vp) && ip->i_delayed_blks > 0) | ||
1543 | xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE); | 1551 | xfs_flush_pages(ip, 0, -1, XFS_B_ASYNC, FI_NONE); |
1544 | } | 1552 | } |
1545 | 1553 | ||