diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-03-05 21:46:12 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 21:40:35 -0400 |
commit | a3da789640871c897901c5f766e33be78d56f35a (patch) | |
tree | cbc8cda24404077100e2d029b21531b219affbfb /fs/xfs | |
parent | 979ebab11623894528d4d37b947533ea4e8649d1 (diff) |
[XFS] cleanup vnode use in xfs_link
SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30547a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.h | 2 |
3 files changed, 17 insertions, 20 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 62899a1ec7f7..1df48209d60a 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -395,23 +395,22 @@ xfs_vn_link( | |||
395 | struct inode *dir, | 395 | struct inode *dir, |
396 | struct dentry *dentry) | 396 | struct dentry *dentry) |
397 | { | 397 | { |
398 | struct inode *ip; /* inode of guy being linked to */ | 398 | struct inode *inode; /* inode of guy being linked to */ |
399 | bhv_vnode_t *vp; /* vp of name being linked */ | ||
400 | int error; | 399 | int error; |
401 | 400 | ||
402 | ip = old_dentry->d_inode; /* inode being linked to */ | 401 | inode = old_dentry->d_inode; |
403 | vp = vn_from_inode(ip); | ||
404 | 402 | ||
405 | VN_HOLD(vp); | 403 | igrab(inode); |
406 | error = xfs_link(XFS_I(dir), vp, dentry); | 404 | error = xfs_link(XFS_I(dir), XFS_I(inode), dentry); |
407 | if (unlikely(error)) { | 405 | if (unlikely(error)) { |
408 | VN_RELE(vp); | 406 | iput(inode); |
409 | } else { | 407 | return -error; |
410 | xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); | ||
411 | xfs_validate_fields(ip); | ||
412 | d_instantiate(dentry, ip); | ||
413 | } | 408 | } |
414 | return -error; | 409 | |
410 | xfs_iflags_set(XFS_I(dir), XFS_IMODIFIED); | ||
411 | xfs_validate_fields(inode); | ||
412 | d_instantiate(dentry, inode); | ||
413 | return 0; | ||
415 | } | 414 | } |
416 | 415 | ||
417 | STATIC int | 416 | STATIC int |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index a42d7fe6a5e8..10d2d22eb037 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2471,12 +2471,10 @@ xfs_remove( | |||
2471 | int | 2471 | int |
2472 | xfs_link( | 2472 | xfs_link( |
2473 | xfs_inode_t *tdp, | 2473 | xfs_inode_t *tdp, |
2474 | bhv_vnode_t *src_vp, | 2474 | xfs_inode_t *sip, |
2475 | bhv_vname_t *dentry) | 2475 | bhv_vname_t *dentry) |
2476 | { | 2476 | { |
2477 | bhv_vnode_t *target_dir_vp = XFS_ITOV(tdp); | ||
2478 | xfs_mount_t *mp = tdp->i_mount; | 2477 | xfs_mount_t *mp = tdp->i_mount; |
2479 | xfs_inode_t *sip = xfs_vtoi(src_vp); | ||
2480 | xfs_trans_t *tp; | 2478 | xfs_trans_t *tp; |
2481 | xfs_inode_t *ips[2]; | 2479 | xfs_inode_t *ips[2]; |
2482 | int error; | 2480 | int error; |
@@ -2489,10 +2487,10 @@ xfs_link( | |||
2489 | int target_namelen; | 2487 | int target_namelen; |
2490 | 2488 | ||
2491 | xfs_itrace_entry(tdp); | 2489 | xfs_itrace_entry(tdp); |
2492 | xfs_itrace_entry(xfs_vtoi(src_vp)); | 2490 | xfs_itrace_entry(sip); |
2493 | 2491 | ||
2494 | target_namelen = VNAMELEN(dentry); | 2492 | target_namelen = VNAMELEN(dentry); |
2495 | ASSERT(!VN_ISDIR(src_vp)); | 2493 | ASSERT(!S_ISDIR(sip->i_d.di_mode)); |
2496 | 2494 | ||
2497 | if (XFS_FORCED_SHUTDOWN(mp)) | 2495 | if (XFS_FORCED_SHUTDOWN(mp)) |
2498 | return XFS_ERROR(EIO); | 2496 | return XFS_ERROR(EIO); |
@@ -2544,8 +2542,8 @@ xfs_link( | |||
2544 | * xfs_trans_cancel will both unlock the inodes and | 2542 | * xfs_trans_cancel will both unlock the inodes and |
2545 | * decrement the associated ref counts. | 2543 | * decrement the associated ref counts. |
2546 | */ | 2544 | */ |
2547 | VN_HOLD(src_vp); | 2545 | IHOLD(sip); |
2548 | VN_HOLD(target_dir_vp); | 2546 | IHOLD(tdp); |
2549 | xfs_trans_ijoin(tp, sip, XFS_ILOCK_EXCL); | 2547 | xfs_trans_ijoin(tp, sip, XFS_ILOCK_EXCL); |
2550 | xfs_trans_ijoin(tp, tdp, XFS_ILOCK_EXCL); | 2548 | xfs_trans_ijoin(tp, tdp, XFS_ILOCK_EXCL); |
2551 | 2549 | ||
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index 0acef1231417..79c13f57a819 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -28,7 +28,7 @@ int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry, | |||
28 | int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode, | 28 | int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode, |
29 | xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp); | 29 | xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp); |
30 | int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry); | 30 | int xfs_remove(struct xfs_inode *dp, bhv_vname_t *dentry); |
31 | int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp, | 31 | int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, |
32 | bhv_vname_t *dentry); | 32 | bhv_vname_t *dentry); |
33 | int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry, | 33 | int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry, |
34 | mode_t mode, struct xfs_inode **ipp, struct cred *credp); | 34 | mode_t mode, struct xfs_inode **ipp, struct cred *credp); |