Thread (36 messages) 36 messages, 3 authors, 2021-06-21

Re: [PATCH 04/16] xfs: clean up xfs_inactive a little bit

From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-06-14 17:34:37

On Mon, Jun 14, 2021 at 12:14:31PM -0400, Brian Foster wrote:
On Sun, Jun 13, 2021 at 10:20:18AM -0700, Darrick J. Wong wrote:
quoted
From: Darrick J. Wong <djwong@kernel.org>

Move the dqattach further up in xfs_inactive.  In theory we should
always have dquots attached if there are CoW blocks, but this makes the
usage pattern more consistent with the rest of xfs (attach dquots, then
start making changes).

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
Something like "xfs: attach dquots earlier in xfs_inactive()" might be a
more appropriate patch title..?

Otherwise seems reasonable:

Reviewed-by: Brian Foster <redacted>

(It also seems like this could be a standalone patch, merged
independently instead of carrying it around with this series.)
<nod> Will do, thanks for reviewing these! :)

--D
quoted
 fs/xfs/xfs_inode.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 85b2b11b5217..67786814997c 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1717,7 +1717,7 @@ xfs_inode_needs_inactive(
  */
 void
 xfs_inactive(
-	xfs_inode_t	*ip)
+	struct xfs_inode	*ip)
 {
 	struct xfs_mount	*mp;
 	int			error;
@@ -1743,6 +1743,11 @@ xfs_inactive(
 	if (xfs_is_metadata_inode(ip))
 		goto out;
 
+	/* Ensure dquots are attached prior to making changes to this file. */
+	error = xfs_qm_dqattach(ip);
+	if (error)
+		goto out;
+
 	/* Try to clean out the cow blocks if there are any. */
 	if (xfs_inode_has_cow_data(ip))
 		xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
@@ -1768,10 +1773,6 @@ xfs_inactive(
 	     ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
 		truncate = 1;
 
-	error = xfs_qm_dqattach(ip);
-	if (error)
-		goto out;
-
 	if (S_ISLNK(VFS_I(ip)->i_mode))
 		error = xfs_inactive_symlink(ip);
 	else if (truncate)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help