diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-03-05 21:46:05 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 21:40:25 -0400 |
commit | 979ebab11623894528d4d37b947533ea4e8649d1 (patch) | |
tree | b7d2554818c1c0e8b2d5a7c581567be3c740247c /fs/xfs/xfs_vnodeops.c | |
parent | bc4ac74a4e5bd7db02976eb1b681e1d11f81c9ce (diff) |
[XFS] cleanup vnode use in xfs_create/mknod/mkdir
SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30546a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 7e124b55c26b..a42d7fe6a5e8 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1791,14 +1791,12 @@ xfs_create( | |||
1791 | bhv_vname_t *dentry, | 1791 | bhv_vname_t *dentry, |
1792 | mode_t mode, | 1792 | mode_t mode, |
1793 | xfs_dev_t rdev, | 1793 | xfs_dev_t rdev, |
1794 | bhv_vnode_t **vpp, | 1794 | xfs_inode_t **ipp, |
1795 | cred_t *credp) | 1795 | cred_t *credp) |
1796 | { | 1796 | { |
1797 | char *name = VNAME(dentry); | 1797 | char *name = VNAME(dentry); |
1798 | xfs_mount_t *mp = dp->i_mount; | 1798 | xfs_mount_t *mp = dp->i_mount; |
1799 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); | ||
1800 | xfs_inode_t *ip; | 1799 | xfs_inode_t *ip; |
1801 | bhv_vnode_t *vp = NULL; | ||
1802 | xfs_trans_t *tp; | 1800 | xfs_trans_t *tp; |
1803 | int error; | 1801 | int error; |
1804 | xfs_bmap_free_t free_list; | 1802 | xfs_bmap_free_t free_list; |
@@ -1812,7 +1810,7 @@ xfs_create( | |||
1812 | uint resblks; | 1810 | uint resblks; |
1813 | int namelen; | 1811 | int namelen; |
1814 | 1812 | ||
1815 | ASSERT(!*vpp); | 1813 | ASSERT(!*ipp); |
1816 | xfs_itrace_entry(dp); | 1814 | xfs_itrace_entry(dp); |
1817 | 1815 | ||
1818 | namelen = VNAMELEN(dentry); | 1816 | namelen = VNAMELEN(dentry); |
@@ -1911,7 +1909,7 @@ xfs_create( | |||
1911 | * the transaction cancel unlocking dp so don't do it explicitly in the | 1909 | * the transaction cancel unlocking dp so don't do it explicitly in the |
1912 | * error path. | 1910 | * error path. |
1913 | */ | 1911 | */ |
1914 | VN_HOLD(dir_vp); | 1912 | IHOLD(dp); |
1915 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 1913 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
1916 | unlock_dp_on_error = B_FALSE; | 1914 | unlock_dp_on_error = B_FALSE; |
1917 | 1915 | ||
@@ -1949,7 +1947,6 @@ xfs_create( | |||
1949 | * vnode to the caller, we bump the vnode ref count now. | 1947 | * vnode to the caller, we bump the vnode ref count now. |
1950 | */ | 1948 | */ |
1951 | IHOLD(ip); | 1949 | IHOLD(ip); |
1952 | vp = XFS_ITOV(ip); | ||
1953 | 1950 | ||
1954 | error = xfs_bmap_finish(&tp, &free_list, &committed); | 1951 | error = xfs_bmap_finish(&tp, &free_list, &committed); |
1955 | if (error) { | 1952 | if (error) { |
@@ -1967,16 +1964,16 @@ xfs_create( | |||
1967 | XFS_QM_DQRELE(mp, udqp); | 1964 | XFS_QM_DQRELE(mp, udqp); |
1968 | XFS_QM_DQRELE(mp, gdqp); | 1965 | XFS_QM_DQRELE(mp, gdqp); |
1969 | 1966 | ||
1970 | *vpp = vp; | 1967 | *ipp = ip; |
1971 | 1968 | ||
1972 | /* Fallthrough to std_return with error = 0 */ | 1969 | /* Fallthrough to std_return with error = 0 */ |
1973 | 1970 | ||
1974 | std_return: | 1971 | std_return: |
1975 | if ((*vpp || (error != 0 && dm_event_sent != 0)) && | 1972 | if ((*ipp || (error != 0 && dm_event_sent != 0)) && |
1976 | DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) { | 1973 | DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) { |
1977 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, | 1974 | (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, |
1978 | dp, DM_RIGHT_NULL, | 1975 | dp, DM_RIGHT_NULL, |
1979 | *vpp ? ip : NULL, | 1976 | *ipp ? ip : NULL, |
1980 | DM_RIGHT_NULL, name, NULL, | 1977 | DM_RIGHT_NULL, name, NULL, |
1981 | mode, error, 0); | 1978 | mode, error, 0); |
1982 | } | 1979 | } |
@@ -2634,15 +2631,13 @@ xfs_mkdir( | |||
2634 | xfs_inode_t *dp, | 2631 | xfs_inode_t *dp, |
2635 | bhv_vname_t *dentry, | 2632 | bhv_vname_t *dentry, |
2636 | mode_t mode, | 2633 | mode_t mode, |
2637 | bhv_vnode_t **vpp, | 2634 | xfs_inode_t **ipp, |
2638 | cred_t *credp) | 2635 | cred_t *credp) |
2639 | { | 2636 | { |
2640 | bhv_vnode_t *dir_vp = XFS_ITOV(dp); | ||
2641 | char *dir_name = VNAME(dentry); | 2637 | char *dir_name = VNAME(dentry); |
2642 | int dir_namelen = VNAMELEN(dentry); | 2638 | int dir_namelen = VNAMELEN(dentry); |
2643 | xfs_mount_t *mp = dp->i_mount; | 2639 | xfs_mount_t *mp = dp->i_mount; |
2644 | xfs_inode_t *cdp; /* inode of created dir */ | 2640 | xfs_inode_t *cdp; /* inode of created dir */ |
2645 | bhv_vnode_t *cvp; /* vnode of created dir */ | ||
2646 | xfs_trans_t *tp; | 2641 | xfs_trans_t *tp; |
2647 | int cancel_flags; | 2642 | int cancel_flags; |
2648 | int error; | 2643 | int error; |
@@ -2749,7 +2744,7 @@ xfs_mkdir( | |||
2749 | * from here on will result in the transaction cancel | 2744 | * from here on will result in the transaction cancel |
2750 | * unlocking dp so don't do it explicitly in the error path. | 2745 | * unlocking dp so don't do it explicitly in the error path. |
2751 | */ | 2746 | */ |
2752 | VN_HOLD(dir_vp); | 2747 | IHOLD(dp); |
2753 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); | 2748 | xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); |
2754 | unlock_dp_on_error = B_FALSE; | 2749 | unlock_dp_on_error = B_FALSE; |
2755 | 2750 | ||
@@ -2780,11 +2775,9 @@ xfs_mkdir( | |||
2780 | if (error) | 2775 | if (error) |
2781 | goto error2; | 2776 | goto error2; |
2782 | 2777 | ||
2783 | cvp = XFS_ITOV(cdp); | ||
2784 | |||
2785 | created = B_TRUE; | 2778 | created = B_TRUE; |
2786 | 2779 | ||
2787 | *vpp = cvp; | 2780 | *ipp = cdp; |
2788 | IHOLD(cdp); | 2781 | IHOLD(cdp); |
2789 | 2782 | ||
2790 | /* | 2783 | /* |