Commit 3ea06d73 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: detach inode dquots at the end of inactivation

Once we're done with inactivating an inode, we're finished updating
metadata for that inode.  This means that we can detach the dquots at
the end and not have to wait for reclaim to do it for us.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 1ad2cfe0
...@@ -1093,7 +1093,7 @@ xfs_reclaim_inode( ...@@ -1093,7 +1093,7 @@ xfs_reclaim_inode(
* unlocked after the lookup before we go ahead and free it. * unlocked after the lookup before we go ahead and free it.
*/ */
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_qm_dqdetach(ip); ASSERT(!ip->i_udquot && !ip->i_gdquot && !ip->i_pdquot);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
ASSERT(xfs_inode_clean(ip)); ASSERT(xfs_inode_clean(ip));
......
...@@ -1716,7 +1716,7 @@ xfs_inactive( ...@@ -1716,7 +1716,7 @@ xfs_inactive(
*/ */
if (VFS_I(ip)->i_mode == 0) { if (VFS_I(ip)->i_mode == 0) {
ASSERT(ip->i_df.if_broot_bytes == 0); ASSERT(ip->i_df.if_broot_bytes == 0);
return; goto out;
} }
mp = ip->i_mount; mp = ip->i_mount;
...@@ -1724,11 +1724,11 @@ xfs_inactive( ...@@ -1724,11 +1724,11 @@ xfs_inactive(
/* If this is a read-only mount, don't do this (would generate I/O) */ /* If this is a read-only mount, don't do this (would generate I/O) */
if (mp->m_flags & XFS_MOUNT_RDONLY) if (mp->m_flags & XFS_MOUNT_RDONLY)
return; goto out;
/* Metadata inodes require explicit resource cleanup. */ /* Metadata inodes require explicit resource cleanup. */
if (xfs_is_metadata_inode(ip)) if (xfs_is_metadata_inode(ip))
return; goto out;
/* Try to clean out the cow blocks if there are any. */ /* Try to clean out the cow blocks if there are any. */
if (xfs_inode_has_cow_data(ip)) if (xfs_inode_has_cow_data(ip))
...@@ -1747,7 +1747,7 @@ xfs_inactive( ...@@ -1747,7 +1747,7 @@ xfs_inactive(
if (xfs_can_free_eofblocks(ip, true)) if (xfs_can_free_eofblocks(ip, true))
xfs_free_eofblocks(ip); xfs_free_eofblocks(ip);
return; goto out;
} }
if (S_ISREG(VFS_I(ip)->i_mode) && if (S_ISREG(VFS_I(ip)->i_mode) &&
...@@ -1757,14 +1757,14 @@ xfs_inactive( ...@@ -1757,14 +1757,14 @@ xfs_inactive(
error = xfs_qm_dqattach(ip); error = xfs_qm_dqattach(ip);
if (error) if (error)
return; goto out;
if (S_ISLNK(VFS_I(ip)->i_mode)) if (S_ISLNK(VFS_I(ip)->i_mode))
error = xfs_inactive_symlink(ip); error = xfs_inactive_symlink(ip);
else if (truncate) else if (truncate)
error = xfs_inactive_truncate(ip); error = xfs_inactive_truncate(ip);
if (error) if (error)
return; goto out;
/* /*
* If there are attributes associated with the file then blow them away * If there are attributes associated with the file then blow them away
...@@ -1774,7 +1774,7 @@ xfs_inactive( ...@@ -1774,7 +1774,7 @@ xfs_inactive(
if (XFS_IFORK_Q(ip)) { if (XFS_IFORK_Q(ip)) {
error = xfs_attr_inactive(ip); error = xfs_attr_inactive(ip);
if (error) if (error)
return; goto out;
} }
ASSERT(!ip->i_afp); ASSERT(!ip->i_afp);
...@@ -1783,12 +1783,12 @@ xfs_inactive( ...@@ -1783,12 +1783,12 @@ xfs_inactive(
/* /*
* Free the inode. * Free the inode.
*/ */
error = xfs_inactive_ifree(ip); xfs_inactive_ifree(ip);
if (error)
return;
out:
/* /*
* Release the dquots held by inode, if any. * We're done making metadata updates for this inode, so we can release
* the attached dquots.
*/ */
xfs_qm_dqdetach(ip); xfs_qm_dqdetach(ip);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment