diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 12:04:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 12:04:11 -0400 |
commit | 347c53dca73fca317d57781f510f5ff4f6c0d0d7 (patch) | |
tree | cdc405ac049751da4d76085ce58750b6b2a22326 /fs/xfs/xfs_rename.c | |
parent | 5c8e191e8437616a498a8e1cc0af3dd0d32bbff2 (diff) | |
parent | 7f015072348a14f16d548be557ee58c5c55df0aa (diff) |
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (59 commits)
[XFS] eagerly remove vmap mappings to avoid upsetting Xen
[XFS] simplify validata_fields
[XFS] no longer using io_vnode, as was remaining from 23 cherrypick
[XFS] Remove STATIC which was missing from prior manual merge
[XFS] Put back the QUEUE_ORDERED_NONE test in the barrier check.
[XFS] Turn off XBF_ASYNC flag before re-reading superblock.
[XFS] avoid race in sync_inodes() that can fail to write out all dirty data
[XFS] This fix prevents bulkstat from spinning in an infinite loop.
[XFS] simplify xfs_create/mknod/symlink prototype
[XFS] avoid xfs_getattr in XFS_IOC_FSGETXATTR ioctl
[XFS] get_bulkall() could return incorrect inode state
[XFS] Kill unused IOMAP_EOF flag
[XFS] fix when DMAPI mount option processing happens
[XFS] ensure file size is logged on synchronous writes
[XFS] growlock should be a mutex
[XFS] replace some large xfs_log_priv.h macros by proper functions
[XFS] kill struct bhv_vfs
[XFS] move syncing related members from struct bhv_vfs to struct xfs_mount
[XFS] kill the vfs_flags member in struct bhv_vfs
[XFS] kill the vfs_fsid and vfs_altfsid members in struct bhv_vfs
...
Diffstat (limited to 'fs/xfs/xfs_rename.c')
-rw-r--r-- | fs/xfs/xfs_rename.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 7679d7a7022d..44ea0ba36476 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "xfs_inum.h" | 22 | #include "xfs_inum.h" |
23 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
24 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
25 | #include "xfs_ag.h" | ||
25 | #include "xfs_dir2.h" | 26 | #include "xfs_dir2.h" |
26 | #include "xfs_dmapi.h" | 27 | #include "xfs_dmapi.h" |
27 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" |
@@ -128,8 +129,7 @@ xfs_lock_for_rename( | |||
128 | lock_mode = xfs_ilock_map_shared(dp2); | 129 | lock_mode = xfs_ilock_map_shared(dp2); |
129 | } | 130 | } |
130 | 131 | ||
131 | error = xfs_dir_lookup_int(XFS_ITOBHV(dp2), lock_mode, | 132 | error = xfs_dir_lookup_int(dp2, lock_mode, vname2, &inum2, &ip2); |
132 | vname2, &inum2, &ip2); | ||
133 | if (error == ENOENT) { /* target does not need to exist. */ | 133 | if (error == ENOENT) { /* target does not need to exist. */ |
134 | inum2 = 0; | 134 | inum2 = 0; |
135 | } else if (error) { | 135 | } else if (error) { |
@@ -221,15 +221,15 @@ xfs_lock_for_rename( | |||
221 | */ | 221 | */ |
222 | int | 222 | int |
223 | xfs_rename( | 223 | xfs_rename( |
224 | bhv_desc_t *src_dir_bdp, | 224 | xfs_inode_t *src_dp, |
225 | bhv_vname_t *src_vname, | 225 | bhv_vname_t *src_vname, |
226 | bhv_vnode_t *target_dir_vp, | 226 | bhv_vnode_t *target_dir_vp, |
227 | bhv_vname_t *target_vname, | 227 | bhv_vname_t *target_vname) |
228 | cred_t *credp) | ||
229 | { | 228 | { |
229 | bhv_vnode_t *src_dir_vp = XFS_ITOV(src_dp); | ||
230 | xfs_trans_t *tp; | 230 | xfs_trans_t *tp; |
231 | xfs_inode_t *src_dp, *target_dp, *src_ip, *target_ip; | 231 | xfs_inode_t *target_dp, *src_ip, *target_ip; |
232 | xfs_mount_t *mp; | 232 | xfs_mount_t *mp = src_dp->i_mount; |
233 | int new_parent; /* moving to a new dir */ | 233 | int new_parent; /* moving to a new dir */ |
234 | int src_is_directory; /* src_name is a directory */ | 234 | int src_is_directory; /* src_name is a directory */ |
235 | int error; | 235 | int error; |
@@ -239,7 +239,6 @@ xfs_rename( | |||
239 | int committed; | 239 | int committed; |
240 | xfs_inode_t *inodes[4]; | 240 | xfs_inode_t *inodes[4]; |
241 | int target_ip_dropped = 0; /* dropped target_ip link? */ | 241 | int target_ip_dropped = 0; /* dropped target_ip link? */ |
242 | bhv_vnode_t *src_dir_vp; | ||
243 | int spaceres; | 242 | int spaceres; |
244 | int target_link_zero = 0; | 243 | int target_link_zero = 0; |
245 | int num_inodes; | 244 | int num_inodes; |
@@ -248,9 +247,8 @@ xfs_rename( | |||
248 | int src_namelen = VNAMELEN(src_vname); | 247 | int src_namelen = VNAMELEN(src_vname); |
249 | int target_namelen = VNAMELEN(target_vname); | 248 | int target_namelen = VNAMELEN(target_vname); |
250 | 249 | ||
251 | src_dir_vp = BHV_TO_VNODE(src_dir_bdp); | 250 | vn_trace_entry(src_dp, "xfs_rename", (inst_t *)__return_address); |
252 | vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address); | 251 | vn_trace_entry(xfs_vtoi(target_dir_vp), "xfs_rename", (inst_t *)__return_address); |
253 | vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address); | ||
254 | 252 | ||
255 | /* | 253 | /* |
256 | * Find the XFS behavior descriptor for the target directory | 254 | * Find the XFS behavior descriptor for the target directory |
@@ -261,12 +259,8 @@ xfs_rename( | |||
261 | return XFS_ERROR(EXDEV); | 259 | return XFS_ERROR(EXDEV); |
262 | } | 260 | } |
263 | 261 | ||
264 | src_dp = XFS_BHVTOI(src_dir_bdp); | 262 | if (DM_EVENT_ENABLED(src_dp, DM_EVENT_RENAME) || |
265 | mp = src_dp->i_mount; | 263 | DM_EVENT_ENABLED(target_dp, DM_EVENT_RENAME)) { |
266 | |||
267 | if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_RENAME) || | ||
268 | DM_EVENT_ENABLED(target_dir_vp->v_vfsp, | ||
269 | target_dp, DM_EVENT_RENAME)) { | ||
270 | error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, | 264 | error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME, |
271 | src_dir_vp, DM_RIGHT_NULL, | 265 | src_dir_vp, DM_RIGHT_NULL, |
272 | target_dir_vp, DM_RIGHT_NULL, | 266 | target_dir_vp, DM_RIGHT_NULL, |
@@ -592,20 +586,16 @@ xfs_rename( | |||
592 | /* | 586 | /* |
593 | * Let interposed file systems know about removed links. | 587 | * Let interposed file systems know about removed links. |
594 | */ | 588 | */ |
595 | if (target_ip_dropped) { | 589 | if (target_ip_dropped) |
596 | bhv_vop_link_removed(XFS_ITOV(target_ip), target_dir_vp, | ||
597 | target_link_zero); | ||
598 | IRELE(target_ip); | 590 | IRELE(target_ip); |
599 | } | ||
600 | 591 | ||
601 | IRELE(src_ip); | 592 | IRELE(src_ip); |
602 | 593 | ||
603 | /* Fall through to std_return with error = 0 or errno from | 594 | /* Fall through to std_return with error = 0 or errno from |
604 | * xfs_trans_commit */ | 595 | * xfs_trans_commit */ |
605 | std_return: | 596 | std_return: |
606 | if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_POSTRENAME) || | 597 | if (DM_EVENT_ENABLED(src_dp, DM_EVENT_POSTRENAME) || |
607 | DM_EVENT_ENABLED(target_dir_vp->v_vfsp, | 598 | DM_EVENT_ENABLED(target_dp, DM_EVENT_POSTRENAME)) { |
608 | target_dp, DM_EVENT_POSTRENAME)) { | ||
609 | (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, | 599 | (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME, |
610 | src_dir_vp, DM_RIGHT_NULL, | 600 | src_dir_vp, DM_RIGHT_NULL, |
611 | target_dir_vp, DM_RIGHT_NULL, | 601 | target_dir_vp, DM_RIGHT_NULL, |