diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-07-04 11:13:32 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-07-29 17:22:20 -0400 |
commit | 5a15322da1a51ad8f3af1962de355885b6c606f2 (patch) | |
tree | 49f527ed442fd504feb2f92d340ba8b6b56ef0b4 /fs/xfs | |
parent | 0b56185b0d64ef89dad1c85bb7403fa762cbe50d (diff) |
xfs: avoid the iolock in xfs_free_eofblocks for evicted inodes
Same rational as the last patch - these inodes are not reachable, so
don't bother with locking.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 79270430daf..2a5c637344b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -146,11 +146,6 @@ xfs_readlink( | |||
146 | } | 146 | } |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Flags for xfs_free_eofblocks | ||
150 | */ | ||
151 | #define XFS_FREE_EOF_TRYLOCK (1<<0) | ||
152 | |||
153 | /* | ||
154 | * This is called by xfs_inactive to free any blocks beyond eof | 149 | * This is called by xfs_inactive to free any blocks beyond eof |
155 | * when the link count isn't zero and by xfs_dm_punch_hole() when | 150 | * when the link count isn't zero and by xfs_dm_punch_hole() when |
156 | * punching a hole to EOF. | 151 | * punching a hole to EOF. |
@@ -159,7 +154,7 @@ STATIC int | |||
159 | xfs_free_eofblocks( | 154 | xfs_free_eofblocks( |
160 | xfs_mount_t *mp, | 155 | xfs_mount_t *mp, |
161 | xfs_inode_t *ip, | 156 | xfs_inode_t *ip, |
162 | int flags) | 157 | bool need_iolock) |
163 | { | 158 | { |
164 | xfs_trans_t *tp; | 159 | xfs_trans_t *tp; |
165 | int error; | 160 | int error; |
@@ -201,13 +196,11 @@ xfs_free_eofblocks( | |||
201 | */ | 196 | */ |
202 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 197 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
203 | 198 | ||
204 | if (flags & XFS_FREE_EOF_TRYLOCK) { | 199 | if (need_iolock) { |
205 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { | 200 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { |
206 | xfs_trans_cancel(tp, 0); | 201 | xfs_trans_cancel(tp, 0); |
207 | return 0; | 202 | return 0; |
208 | } | 203 | } |
209 | } else { | ||
210 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | ||
211 | } | 204 | } |
212 | 205 | ||
213 | error = xfs_trans_reserve(tp, 0, | 206 | error = xfs_trans_reserve(tp, 0, |
@@ -217,7 +210,8 @@ xfs_free_eofblocks( | |||
217 | if (error) { | 210 | if (error) { |
218 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); | 211 | ASSERT(XFS_FORCED_SHUTDOWN(mp)); |
219 | xfs_trans_cancel(tp, 0); | 212 | xfs_trans_cancel(tp, 0); |
220 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 213 | if (need_iolock) |
214 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
221 | return error; | 215 | return error; |
222 | } | 216 | } |
223 | 217 | ||
@@ -244,7 +238,10 @@ xfs_free_eofblocks( | |||
244 | error = xfs_trans_commit(tp, | 238 | error = xfs_trans_commit(tp, |
245 | XFS_TRANS_RELEASE_LOG_RES); | 239 | XFS_TRANS_RELEASE_LOG_RES); |
246 | } | 240 | } |
247 | xfs_iunlock(ip, XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL); | 241 | |
242 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
243 | if (need_iolock) | ||
244 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | ||
248 | } | 245 | } |
249 | return error; | 246 | return error; |
250 | } | 247 | } |
@@ -466,8 +463,7 @@ xfs_release( | |||
466 | if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE)) | 463 | if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE)) |
467 | return 0; | 464 | return 0; |
468 | 465 | ||
469 | error = xfs_free_eofblocks(mp, ip, | 466 | error = xfs_free_eofblocks(mp, ip, true); |
470 | XFS_FREE_EOF_TRYLOCK); | ||
471 | if (error) | 467 | if (error) |
472 | return error; | 468 | return error; |
473 | 469 | ||
@@ -524,7 +520,7 @@ xfs_inactive( | |||
524 | (!(ip->i_d.di_flags & | 520 | (!(ip->i_d.di_flags & |
525 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) || | 521 | (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) || |
526 | ip->i_delayed_blks != 0))) { | 522 | ip->i_delayed_blks != 0))) { |
527 | error = xfs_free_eofblocks(mp, ip, 0); | 523 | error = xfs_free_eofblocks(mp, ip, false); |
528 | if (error) | 524 | if (error) |
529 | return VN_INACTIVE_CACHE; | 525 | return VN_INACTIVE_CACHE; |
530 | } | 526 | } |