Skip to contentSkip to conversation

xfs: improve the assert at the top of xfs_log_cover

PATCH Applied Christoph Hellwig 3 participants 3 messages Jan 9 – Jan 13 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: improve the assert at the top of xfs_log_cover

Move each condition into a separate assert so that we can see which on triggered.

---
 fs/xfs/xfs_log.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/xfs_log.c +5 -3
index 511756429336..8ddd25970471 100644
@@ -1138,9 +1138,11 @@ xfs_log_cover(
 	int			error = 0;
 	bool			need_covered;
 
-	ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
-	        !xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
-		xlog_is_shutdown(mp->m_log));
+	if (!xlog_is_shutdown(mp->m_log)) {
+		ASSERT(xlog_cil_empty(mp->m_log));
+		ASSERT(xlog_iclogs_empty(mp->m_log));
+		ASSERT(!xfs_ail_min_lsn(mp->m_log->l_ailp));
+	}
 
 	if (!xfs_log_writable(mp))
 		return 0;
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christoph Hellwig

Move each condition into a separate assert so that we can see which on triggered.

Yes that's really helpful for observability;

--D

Quoted 27 lines
---
 fs/xfs/xfs_log.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/xfs_log.c +5 -3
index 511756429336..8ddd25970471 100644
@@ -1138,9 +1138,11 @@ xfs_log_cover(
 	int			error = 0;
 	bool			need_covered;
 
-	ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
-	        !xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
-		xlog_is_shutdown(mp->m_log));
+	if (!xlog_is_shutdown(mp->m_log)) {
+		ASSERT(xlog_cil_empty(mp->m_log));
+		ASSERT(xlog_iclogs_empty(mp->m_log));
+		ASSERT(!xfs_ail_min_lsn(mp->m_log->l_ailp));
+	}
 
 	if (!xfs_log_writable(mp))
 		return 0;
Signature · 1 line
2.47.3
maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

Move each condition into a separate assert so that we can see which on triggered.

Applied to for-next, thanks!

[1/1] xfs: improve the assert at the top of xfs_log_cover

      commit: df7ec7226fbe14d8654193933da81b2470cc5814

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>