[PATCH 4/5] xfs: tell xfs_attr_set if the log is actually letting us use LARP mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Add a means for xfs_attr_use_log_assist to tell its caller if we have a
lock on using LARP mode.  This will be used in the next patch it will be
useful to turn it on for a batch update.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_attr.c |    8 ++++----
 fs/xfs/xfs_log.c         |   10 +++++++---
 fs/xfs/xfs_log.h         |    2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)


diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 9f14aca29ec4..1de3db88e006 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -982,7 +982,7 @@ xfs_attr_set(
 	int			error, local;
 	int			rmt_blks = 0;
 	unsigned int		total;
-	bool			use_logging = xfs_has_larp(mp);
+	bool			need_rele = false;
 
 	if (xfs_is_shutdown(dp->i_mount))
 		return -EIO;
@@ -1027,8 +1027,8 @@ xfs_attr_set(
 		rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
 	}
 
-	if (use_logging) {
-		error = xfs_attr_use_log_assist(mp);
+	if (xfs_has_larp(mp)) {
+		error = xfs_attr_use_log_assist(mp, &need_rele);
 		if (error)
 			return error;
 	}
@@ -1101,7 +1101,7 @@ xfs_attr_set(
 out_unlock:
 	xfs_iunlock(dp, XFS_ILOCK_EXCL);
 drop_incompat:
-	if (use_logging)
+	if (need_rele)
 		xlog_drop_incompat_feat(mp->m_log);
 	return error;
 
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index edd077e055d5..bd41e0dc95ff 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3879,15 +3879,17 @@ xlog_drop_incompat_feat(
 }
 
 /*
- * Get permission to use log-assisted atomic exchange of file extents.
+ * Get permission to use log-assisted extended attribute updates.
  *
  * Callers must not be running any transactions or hold any inode locks, and
  * they must release the permission by calling xlog_drop_incompat_feat
- * when they're done.
+ * when they're done.  The @need_rele parameter will be set to true if the
+ * caller should drop permission after the call.
  */
 int
 xfs_attr_use_log_assist(
-	struct xfs_mount	*mp)
+	struct xfs_mount	*mp,
+	bool			*need_rele)
 {
 	int			error = 0;
 
@@ -3896,6 +3898,7 @@ xfs_attr_use_log_assist(
 	 * incompat feature bit.
 	 */
 	xlog_use_incompat_feat(mp->m_log);
+	*need_rele = true;
 
 	/*
 	 * If log-assisted xattrs are already enabled, the caller can use the
@@ -3916,5 +3919,6 @@ xfs_attr_use_log_assist(
 	return 0;
 drop_incompat:
 	xlog_drop_incompat_feat(mp->m_log);
+	*need_rele = false;
 	return error;
 }
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index f3ce046a7d45..166d2310af0b 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -160,6 +160,6 @@ bool	  xlog_force_shutdown(struct xlog *log, uint32_t shutdown_flags);
 
 void xlog_use_incompat_feat(struct xlog *log);
 void xlog_drop_incompat_feat(struct xlog *log);
-int xfs_attr_use_log_assist(struct xfs_mount *mp);
+int xfs_attr_use_log_assist(struct xfs_mount *mp, bool *need_rele);
 
 #endif	/* __XFS_LOG_H__ */




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux