diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-03 17:33:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-03 17:33:38 -0400 |
commit | 51102ee5b8853d230e534cbcd0d888f0134738a3 (patch) | |
tree | 5a34844b3040dbc099dd0d3ebc2e6fca0bc65855 /fs/xfs/xfs_rename.c | |
parent | 54161df1fb1469d66bce3a3b14d8281adbb69263 (diff) | |
parent | 6b0a2996a0c023d84bc27ec7528a6e54cb5ea264 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
* 'for-linus' of git://oss.sgi.com/xfs/xfs: (49 commits)
xfs simplify and speed up direct I/O completions
xfs: move aio completion after unwritten extent conversion
direct-io: move aio_complete into ->end_io
xfs: fix big endian build
xfs: clean up xfs_bmap_get_bp
xfs: simplify xfs_truncate_file
xfs: kill the b_strat callback in xfs_buf
xfs: remove obsolete osyncisosync mount option
xfs: clean up filestreams helpers
xfs: fix gcc 4.6 set but not read and unused statement warnings
xfs: Fix build when CONFIG_XFS_POSIX_ACL=n
xfs: fix unsigned underflow in xfs_free_eofblocks
xfs: use GFP_NOFS for page cache allocation
xfs: fix memory reclaim recursion deadlock on locked inode buffer
xfs: fix xfs_trans_add_item() lockdep warnings
xfs: simplify and remove xfs_ireclaim
xfs: don't block on buffer read errors
xfs: move inode shrinker unregister even earlier
xfs: remove a dmapi leftover
xfs: writepage always has buffers
...
Diffstat (limited to 'fs/xfs/xfs_rename.c')
-rw-r--r-- | fs/xfs/xfs_rename.c | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index fc1cda23b81..8fca957200d 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -24,12 +24,9 @@ | |||
24 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
25 | #include "xfs_ag.h" | 25 | #include "xfs_ag.h" |
26 | #include "xfs_dir2.h" | 26 | #include "xfs_dir2.h" |
27 | #include "xfs_dmapi.h" | ||
28 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
29 | #include "xfs_da_btree.h" | 28 | #include "xfs_da_btree.h" |
30 | #include "xfs_bmap_btree.h" | 29 | #include "xfs_bmap_btree.h" |
31 | #include "xfs_dir2_sf.h" | ||
32 | #include "xfs_attr_sf.h" | ||
33 | #include "xfs_dinode.h" | 30 | #include "xfs_dinode.h" |
34 | #include "xfs_inode.h" | 31 | #include "xfs_inode.h" |
35 | #include "xfs_inode_item.h" | 32 | #include "xfs_inode_item.h" |
@@ -116,20 +113,7 @@ xfs_rename( | |||
116 | int spaceres; | 113 | int spaceres; |
117 | int num_inodes; | 114 | int num_inodes; |
118 | 115 | ||
119 | xfs_itrace_entry(src_dp); | 116 | trace_xfs_rename(src_dp, target_dp, src_name, target_name); |
120 | xfs_itrace_entry(target_dp); | ||
121 | |||
122 | if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) || | ||
123 | DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) { | ||
124 | error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, | ||
125 | src_dp, DM_RIGHT_NULL, | ||
126 | target_dp, DM_RIGHT_NULL, | ||
127 | src_name->name, target_name->name, | ||
128 | 0, 0, 0); | ||
129 | if (error) | ||
130 | return error; | ||
131 | } | ||
132 | /* Return through std_return after this point. */ | ||
133 | 117 | ||
134 | new_parent = (src_dp != target_dp); | 118 | new_parent = (src_dp != target_dp); |
135 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); | 119 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); |
@@ -184,26 +168,14 @@ xfs_rename( | |||
184 | /* | 168 | /* |
185 | * Join all the inodes to the transaction. From this point on, | 169 | * Join all the inodes to the transaction. From this point on, |
186 | * we can rely on either trans_commit or trans_cancel to unlock | 170 | * we can rely on either trans_commit or trans_cancel to unlock |
187 | * them. Note that we need to add a vnode reference to the | 171 | * them. |
188 | * directories since trans_commit & trans_cancel will decrement | ||
189 | * them when they unlock the inodes. Also, we need to be careful | ||
190 | * not to add an inode to the transaction more than once. | ||
191 | */ | 172 | */ |
192 | IHOLD(src_dp); | 173 | xfs_trans_ijoin_ref(tp, src_dp, XFS_ILOCK_EXCL); |
193 | xfs_trans_ijoin(tp, src_dp, XFS_ILOCK_EXCL); | 174 | if (new_parent) |
194 | 175 | xfs_trans_ijoin_ref(tp, target_dp, XFS_ILOCK_EXCL); | |
195 | if (new_parent) { | 176 | xfs_trans_ijoin_ref(tp, src_ip, XFS_ILOCK_EXCL); |
196 | IHOLD(target_dp); | 177 | if (target_ip) |
197 | xfs_trans_ijoin(tp, target_dp, XFS_ILOCK_EXCL); | 178 | xfs_trans_ijoin_ref(tp, target_ip, XFS_ILOCK_EXCL); |
198 | } | ||
199 | |||
200 | IHOLD(src_ip); | ||
201 | xfs_trans_ijoin(tp, src_ip, XFS_ILOCK_EXCL); | ||
202 | |||
203 | if (target_ip) { | ||
204 | IHOLD(target_ip); | ||
205 | xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL); | ||
206 | } | ||
207 | 179 | ||
208 | /* | 180 | /* |
209 | * If we are using project inheritance, we only allow renames | 181 | * If we are using project inheritance, we only allow renames |
@@ -369,26 +341,13 @@ xfs_rename( | |||
369 | * trans_commit will unlock src_ip, target_ip & decrement | 341 | * trans_commit will unlock src_ip, target_ip & decrement |
370 | * the vnode references. | 342 | * the vnode references. |
371 | */ | 343 | */ |
372 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 344 | return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
373 | |||
374 | /* Fall through to std_return with error = 0 or errno from | ||
375 | * xfs_trans_commit */ | ||
376 | std_return: | ||
377 | if (DM_EVENT_ENABLED(src_dp, DM_EVENT_POSTRENAME) || | ||
378 | DM_EVENT_ENABLED(target_dp, DM_EVENT_POSTRENAME)) { | ||
379 | (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, | ||
380 | src_dp, DM_RIGHT_NULL, | ||
381 | target_dp, DM_RIGHT_NULL, | ||
382 | src_name->name, target_name->name, | ||
383 | 0, error, 0); | ||
384 | } | ||
385 | return error; | ||
386 | 345 | ||
387 | abort_return: | 346 | abort_return: |
388 | cancel_flags |= XFS_TRANS_ABORT; | 347 | cancel_flags |= XFS_TRANS_ABORT; |
389 | /* FALLTHROUGH */ | ||
390 | error_return: | 348 | error_return: |
391 | xfs_bmap_cancel(&free_list); | 349 | xfs_bmap_cancel(&free_list); |
392 | xfs_trans_cancel(tp, cancel_flags); | 350 | xfs_trans_cancel(tp, cancel_flags); |
393 | goto std_return; | 351 | std_return: |
352 | return error; | ||
394 | } | 353 | } |