]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] cleanup vnode use in xfs_create/mknod/mkdir
authorChristoph Hellwig <hch@infradead.org>
Thu, 6 Mar 2008 02:46:05 +0000 (13:46 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Fri, 18 Apr 2008 01:40:25 +0000 (11:40 +1000)
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>
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.h

index 346701183318da6af656089051b364780789589b..62899a1ec7f7a7a6e96268ac9ad16138d93e53e6 100644 (file)
@@ -273,7 +273,7 @@ xfs_vn_mknod(
        dev_t           rdev)
 {
        struct inode    *inode;
-       bhv_vnode_t     *vp = NULL, *dvp = vn_from_inode(dir);
+       struct xfs_inode *ip = NULL;
        xfs_acl_t       *default_acl = NULL;
        attrexists_t    test_default_acl = _ACL_DEFAULT_EXISTS;
        int             error;
@@ -285,11 +285,11 @@ xfs_vn_mknod(
        if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
                return -EINVAL;
 
-       if (test_default_acl && test_default_acl(dvp)) {
+       if (test_default_acl && test_default_acl(dir)) {
                if (!_ACL_ALLOC(default_acl)) {
                        return -ENOMEM;
                }
-               if (!_ACL_GET_DEFAULT(dvp, default_acl)) {
+               if (!_ACL_GET_DEFAULT(dir, default_acl)) {
                        _ACL_FREE(default_acl);
                        default_acl = NULL;
                }
@@ -305,10 +305,10 @@ xfs_vn_mknod(
        case S_IFSOCK:
                rdev = sysv_encode_dev(rdev);
        case S_IFREG:
-               error = xfs_create(XFS_I(dir), dentry, mode, rdev, &vp, NULL);
+               error = xfs_create(XFS_I(dir), dentry, mode, rdev, &ip, NULL);
                break;
        case S_IFDIR:
-               error = xfs_mkdir(XFS_I(dir), dentry, mode, &vp, NULL);
+               error = xfs_mkdir(XFS_I(dir), dentry, mode, &ip, NULL);
                break;
        default:
                error = EINVAL;
@@ -318,19 +318,20 @@ xfs_vn_mknod(
        if (unlikely(error))
                goto out_free_acl;
 
-       error = xfs_init_security(vp, dir);
+       inode = ip->i_vnode;
+
+       error = xfs_init_security(inode, dir);
        if (unlikely(error))
                goto out_cleanup_inode;
 
        if (default_acl) {
-               error = _ACL_INHERIT(vp, mode, default_acl);
+               error = _ACL_INHERIT(inode, mode, default_acl);
                if (unlikely(error))
                        goto out_cleanup_inode;
-               xfs_iflags_set(XFS_I(vp), XFS_IMODIFIED);
+               xfs_iflags_set(ip, XFS_IMODIFIED);
                _ACL_FREE(default_acl);
        }
 
-       inode = vn_to_inode(vp);
 
        if (S_ISDIR(mode))
                xfs_validate_fields(inode);
@@ -339,7 +340,7 @@ xfs_vn_mknod(
        return -error;
 
  out_cleanup_inode:
-       xfs_cleanup_inode(dir, vp, dentry, mode);
+       xfs_cleanup_inode(dir, inode, dentry, mode);
  out_free_acl:
        if (default_acl)
                _ACL_FREE(default_acl);
index 7e124b55c26b56192cf28be81e9ad9aa258155a2..a42d7fe6a5e89715b452ddeeceb7305aba29ab1a 100644 (file)
@@ -1791,14 +1791,12 @@ xfs_create(
        bhv_vname_t             *dentry,
        mode_t                  mode,
        xfs_dev_t               rdev,
-       bhv_vnode_t             **vpp,
+       xfs_inode_t             **ipp,
        cred_t                  *credp)
 {
        char                    *name = VNAME(dentry);
        xfs_mount_t             *mp = dp->i_mount;
-       bhv_vnode_t             *dir_vp = XFS_ITOV(dp);
        xfs_inode_t             *ip;
-       bhv_vnode_t             *vp = NULL;
        xfs_trans_t             *tp;
        int                     error;
        xfs_bmap_free_t         free_list;
@@ -1812,7 +1810,7 @@ xfs_create(
        uint                    resblks;
        int                     namelen;
 
-       ASSERT(!*vpp);
+       ASSERT(!*ipp);
        xfs_itrace_entry(dp);
 
        namelen = VNAMELEN(dentry);
@@ -1911,7 +1909,7 @@ xfs_create(
         * the transaction cancel unlocking dp so don't do it explicitly in the
         * error path.
         */
-       VN_HOLD(dir_vp);
+       IHOLD(dp);
        xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
        unlock_dp_on_error = B_FALSE;
 
@@ -1949,7 +1947,6 @@ xfs_create(
         * vnode to the caller, we bump the vnode ref count now.
         */
        IHOLD(ip);
-       vp = XFS_ITOV(ip);
 
        error = xfs_bmap_finish(&tp, &free_list, &committed);
        if (error) {
@@ -1967,16 +1964,16 @@ xfs_create(
        XFS_QM_DQRELE(mp, udqp);
        XFS_QM_DQRELE(mp, gdqp);
 
-       *vpp = vp;
+       *ipp = ip;
 
        /* Fallthrough to std_return with error = 0  */
 
 std_return:
-       if ((*vpp || (error != 0 && dm_event_sent != 0)) &&
+       if ((*ipp || (error != 0 && dm_event_sent != 0)) &&
            DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
                (void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
                        dp, DM_RIGHT_NULL,
-                       *vpp ? ip : NULL,
+                       *ipp ? ip : NULL,
                        DM_RIGHT_NULL, name, NULL,
                        mode, error, 0);
        }
@@ -2634,15 +2631,13 @@ xfs_mkdir(
        xfs_inode_t             *dp,
        bhv_vname_t             *dentry,
        mode_t                  mode,
-       bhv_vnode_t             **vpp,
+       xfs_inode_t             **ipp,
        cred_t                  *credp)
 {
-       bhv_vnode_t             *dir_vp = XFS_ITOV(dp);
        char                    *dir_name = VNAME(dentry);
        int                     dir_namelen = VNAMELEN(dentry);
        xfs_mount_t             *mp = dp->i_mount;
        xfs_inode_t             *cdp;   /* inode of created dir */
-       bhv_vnode_t             *cvp;   /* vnode of created dir */
        xfs_trans_t             *tp;
        int                     cancel_flags;
        int                     error;
@@ -2749,7 +2744,7 @@ xfs_mkdir(
         * from here on will result in the transaction cancel
         * unlocking dp so don't do it explicitly in the error path.
         */
-       VN_HOLD(dir_vp);
+       IHOLD(dp);
        xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
        unlock_dp_on_error = B_FALSE;
 
@@ -2780,11 +2775,9 @@ xfs_mkdir(
        if (error)
                goto error2;
 
-       cvp = XFS_ITOV(cdp);
-
        created = B_TRUE;
 
-       *vpp = cvp;
+       *ipp = cdp;
        IHOLD(cdp);
 
        /*
index 85340bafd42deec4c6b600e6fc04ac21d73e9fa6..0acef123141752fa669e5475426ed782de85dbf9 100644 (file)
@@ -26,12 +26,12 @@ int xfs_inactive(struct xfs_inode *ip);
 int xfs_lookup(struct xfs_inode *dp, bhv_vname_t *dentry,
                bhv_vnode_t **vpp);
 int xfs_create(struct xfs_inode *dp, bhv_vname_t *dentry, mode_t mode,
-               xfs_dev_t rdev, bhv_vnode_t **vpp, struct cred *credp);
+               xfs_dev_t rdev, struct xfs_inode **ipp, struct cred *credp);
 int xfs_remove(struct xfs_inode *dp, bhv_vname_t       *dentry);
 int xfs_link(struct xfs_inode *tdp, bhv_vnode_t *src_vp,
                bhv_vname_t *dentry);
 int xfs_mkdir(struct xfs_inode *dp, bhv_vname_t *dentry,
-               mode_t mode, bhv_vnode_t **vpp, struct cred *credp);
+               mode_t mode, struct xfs_inode **ipp, struct cred *credp);
 int xfs_rmdir(struct xfs_inode *dp, bhv_vname_t *dentry);
 int xfs_readdir(struct xfs_inode       *dp, void *dirent, size_t bufsize,
                       xfs_off_t *offset, filldir_t filldir);