Skip to contentSkip to conversation

xfs: fix unused variable warning

PATCH In review Arnd Bergmann 2 participants 2 messages Feb 4, 2021 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix unused variable warning

From: Arnd Bergmann <[email protected]>

When debugging is disabled, the ASSERT() is left out and the 'log' variable becomes unused:

fs/xfs/xfs_log.c:1111:16: error: unused variable 'log' [-Werror,-Wunused-variable]

Remove the variable declaration and open-code it inside of the assertion.

Fixes 303591a0a947 ("xfs: cover the log during log quiesce")
---
 fs/xfs/xfs_log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/xfs/xfs_log.c +2 -3
index 58699881c100..d8b814227734 100644
@@ -1108,12 +1108,11 @@ static int
 xfs_log_cover(
 	struct xfs_mount	*mp)
 {
-	struct xlog		*log = mp->m_log;
 	int			error = 0;
 	bool			need_covered;
 
-	ASSERT((xlog_cil_empty(log) && xlog_iclogs_empty(log) &&
-	        !xfs_ail_min_lsn(log->l_ailp)) ||
+	ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
+	        !xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
 	       XFS_FORCED_SHUTDOWN(mp));
 
 	if (!xfs_log_writable(mp))
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

When debugging is disabled, the ASSERT() is left out and the 'log' variable becomes unused:

Quoted 8 lines

fs/xfs/xfs_log.c:1111:16: error: unused variable 'log' [-Werror,-Wunused-variable]

Remove the variable declaration and open-code it inside of the assertion.

Fixes 303591a0a947 ("xfs: cover the log during log quiesce")

---

I sent basically the same patch[1] about a week ago, but either one is fine with me:

[1] https://lore.kernel.org/linux-xfs/20210125132616.GB2047559@bfoster/

Quoted 25 lines
 fs/xfs/xfs_log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/xfs/xfs_log.c +2 -3
index 58699881c100..d8b814227734 100644
@@ -1108,12 +1108,11 @@ static int
 xfs_log_cover(
 	struct xfs_mount	*mp)
 {
-	struct xlog		*log = mp->m_log;
 	int			error = 0;
 	bool			need_covered;
 
-	ASSERT((xlog_cil_empty(log) && xlog_iclogs_empty(log) &&
-	        !xfs_ail_min_lsn(log->l_ailp)) ||
+	ASSERT((xlog_cil_empty(mp->m_log) && xlog_iclogs_empty(mp->m_log) &&
+	        !xfs_ail_min_lsn(mp->m_log->l_ailp)) ||
 	       XFS_FORCED_SHUTDOWN(mp));
 
 	if (!xfs_log_writable(mp))
Signature · 1 line
2.29.2