xfs: split xfs_itruncate_finish
[pandora-kernel.git] / fs / xfs / xfs_attr.c
index c863753..795d5aa 100644 (file)
@@ -489,6 +489,13 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)
        args.total = 0;
        args.whichfork = XFS_ATTR_FORK;
 
+       /*
+        * we have no control over the attribute names that userspace passes us
+        * to remove, so we have to allow the name lookup prior to attribute
+        * removal to fail.
+        */
+       args.op_flags = XFS_DA_OP_OKNOENT;
+
        /*
         * Attach the dquots to the inode.
         */
@@ -815,17 +822,21 @@ xfs_attr_inactive(xfs_inode_t *dp)
        error = xfs_attr_root_inactive(&trans, dp);
        if (error)
                goto out;
+
        /*
-        * signal synchronous inactive transactions unless this
-        * is a synchronous mount filesystem in which case we
-        * know that we're here because we've been called out of
-        * xfs_inactive which means that the last reference is gone
-        * and the unlink transaction has already hit the disk so
-        * async inactive transactions are safe.
+        * Signal synchronous inactive transactions unless this is a
+        * synchronous mount filesystem in which case we know that we're here
+        * because we've been called out of xfs_inactive which means that the
+        * last reference is gone and the unlink transaction has already hit
+        * the disk so async inactive transactions are safe.
         */
-       if ((error = xfs_itruncate_finish(&trans, dp, 0LL, XFS_ATTR_FORK,
-                               (!(mp->m_flags & XFS_MOUNT_WSYNC)
-                                ? 1 : 0))))
+       if (!(mp->m_flags & XFS_MOUNT_WSYNC)) {
+               if (dp->i_d.di_anextents > 0)
+                       xfs_trans_set_sync(trans);
+       }
+
+       error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0);
+       if (error)
                goto out;
 
        /*