linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: fix unused variable warning
@ 2021-02-04 16:03 Arnd Bergmann
  2021-02-04 18:07 ` Brian Foster
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2021-02-04 16:03 UTC (permalink / raw)
  To: Darrick J. Wong, linux-xfs, Brian Foster, Allison Henderson
  Cc: Arnd Bergmann, Dave Chinner, Gao Xiang, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/xfs/xfs_log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 58699881c100..d8b814227734 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -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))
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: fix unused variable warning
  2021-02-04 16:03 [PATCH] xfs: fix unused variable warning Arnd Bergmann
@ 2021-02-04 18:07 ` Brian Foster
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Foster @ 2021-02-04 18:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Darrick J. Wong, linux-xfs, Allison Henderson, Arnd Bergmann,
	Dave Chinner, Gao Xiang, linux-kernel

On Thu, Feb 04, 2021 at 05:03:44PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

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

Reviewed-by: Brian Foster <bfoster@redhat.com>

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

>  fs/xfs/xfs_log.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 58699881c100..d8b814227734 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -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))
> -- 
> 2.29.2
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: fix unused variable warning
  2011-10-06 11:24 ` Alex Elder
@ 2011-10-06 21:56   ` Dave Chinner
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2011-10-06 21:56 UTC (permalink / raw)
  To: Alex Elder; +Cc: xfs

On Thu, Oct 06, 2011 at 06:24:27AM -0500, Alex Elder wrote:
> On Thu, 2011-10-06 at 15:57 +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> > 
> > Fix this warning:
> > 
> > fs/xfs/xfs_aops.c: In function 'xfs_end_io_direct_write':
> > fs/xfs/xfs_aops.c:1280:17: warning: unused variable 'inode' [-Wunused-variable]
> > 
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> 
> That line of code is not present in the current XFS
> master branch on oss.sgi.com.

I've got a 3.1-rc9 kernel that I merged the current XFS tree in.
There were a couple of merge conflicts that I fixed, so maybe that's
where it came from. I'll check.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfs: fix unused variable warning
  2011-10-06  4:57 Dave Chinner
@ 2011-10-06 11:24 ` Alex Elder
  2011-10-06 21:56   ` Dave Chinner
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Elder @ 2011-10-06 11:24 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On Thu, 2011-10-06 at 15:57 +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> Fix this warning:
> 
> fs/xfs/xfs_aops.c: In function 'xfs_end_io_direct_write':
> fs/xfs/xfs_aops.c:1280:17: warning: unused variable 'inode' [-Wunused-variable]
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

That line of code is not present in the current XFS
master branch on oss.sgi.com.

					-Alex

> ---
>  fs/xfs/xfs_aops.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index 462e937..11b2aad 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -1277,7 +1277,6 @@ xfs_end_io_direct_write(
>  	bool			is_async)
>  {
>  	struct xfs_ioend	*ioend = iocb->private;
> -	struct inode		*inode = ioend->io_inode;
>  
>  	/*
>  	 * blockdev_direct_IO can return an error even after the I/O



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] xfs: fix unused variable warning
@ 2011-10-06  4:57 Dave Chinner
  2011-10-06 11:24 ` Alex Elder
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Chinner @ 2011-10-06  4:57 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

Fix this warning:

fs/xfs/xfs_aops.c: In function 'xfs_end_io_direct_write':
fs/xfs/xfs_aops.c:1280:17: warning: unused variable 'inode' [-Wunused-variable]

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_aops.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 462e937..11b2aad 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -1277,7 +1277,6 @@ xfs_end_io_direct_write(
 	bool			is_async)
 {
 	struct xfs_ioend	*ioend = iocb->private;
-	struct inode		*inode = ioend->io_inode;
 
 	/*
 	 * blockdev_direct_IO can return an error even after the I/O
-- 
1.7.5.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-04 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 16:03 [PATCH] xfs: fix unused variable warning Arnd Bergmann
2021-02-04 18:07 ` Brian Foster
  -- strict thread matches above, loose matches on Subject: below --
2011-10-06  4:57 Dave Chinner
2011-10-06 11:24 ` Alex Elder
2011-10-06 21:56   ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).