Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_utils.c
index fefe1d60377fc825eecbf688ede1e2e6a4fce4ed..673b405eaa31cfc82d38bff06052a7847e20a4c7 100644 (file)
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_bmap_btree.h"
-#include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
 #include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
  */
 int
 xfs_get_dir_entry(
-       vname_t         *dentry,
+       bhv_vname_t     *dentry,
        xfs_inode_t     **ipp)
 {
-       vnode_t         *vp;
-       bhv_desc_t      *bdp;
+       bhv_vnode_t     *vp;
 
        vp = VNAME_TO_VNODE(dentry);
-       bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops);
-       if (!bdp) {
-               *ipp = NULL;
+
+       *ipp = xfs_vtoi(vp);
+       if (!*ipp)
                return XFS_ERROR(ENOENT);
-       }
        VN_HOLD(vp);
-       *ipp = XFS_BHVTOI(bdp);
        return 0;
 }
 
 int
 xfs_dir_lookup_int(
-       bhv_desc_t      *dir_bdp,
+       xfs_inode_t     *dp,
        uint            lock_mode,
-       vname_t         *dentry,
+       bhv_vname_t     *dentry,
        xfs_ino_t       *inum,
        xfs_inode_t     **ipp)
 {
-       vnode_t         *dir_vp;
-       xfs_inode_t     *dp;
        int             error;
 
-       dir_vp = BHV_TO_VNODE(dir_bdp);
-       vn_trace_entry(dir_vp, __FUNCTION__, (inst_t *)__return_address);
-
-       dp = XFS_BHVTOI(dir_bdp);
+       vn_trace_entry(dp, __FUNCTION__, (inst_t *)__return_address);
 
-       error = XFS_DIR_LOOKUP(dp->i_mount, NULL, dp,
-                               VNAME(dentry), VNAMELEN(dentry), inum);
+       error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum);
        if (!error) {
                /*
                 * Unlock the directory. We do this because we can't
@@ -228,7 +217,7 @@ xfs_dir_ialloc(
                }
 
                ntp = xfs_trans_dup(tp);
-               code = xfs_trans_commit(tp, 0, NULL);
+               code = xfs_trans_commit(tp, 0);
                tp = ntp;
                if (committed != NULL) {
                        *committed = 1;
@@ -426,7 +415,11 @@ xfs_truncate_file(
         * in a transaction.
         */
        xfs_ilock(ip, XFS_IOLOCK_EXCL);
-       xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, (xfs_fsize_t)0);
+       error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE, (xfs_fsize_t)0);
+       if (error) {
+               xfs_iunlock(ip, XFS_IOLOCK_EXCL);
+               return error;
+       }
 
        tp = xfs_trans_alloc(mp, XFS_TRANS_TRUNCATE_FILE);
        if ((error = xfs_trans_reserve(tp, 0, XFS_ITRUNCATE_LOG_RES(mp), 0,
@@ -466,8 +459,7 @@ xfs_truncate_file(
                                 XFS_TRANS_ABORT);
        } else {
                xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-               error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES,
-                                        NULL);
+               error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
        }
        xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);