mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] filelock: ignore 'lock' argument to for_each_file_lock()
@ 2024-02-12 11:26 Arnd Bergmann
  2024-02-12 12:07 ` Christian Brauner
  2024-02-12 12:08 ` Jeff Layton
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-02-12 11:26 UTC (permalink / raw)
  To: NeilBrown, Christian Brauner, Jeff Layton
  Cc: Arnd Bergmann, Luca Vizzarro, Tom Talpey, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_FILE_LOCKING is disabled, ceph causes a warning about
a variable that is only used insode of the for_each_file_lock()
loop:

fs/ceph/locks.c: In function 'ceph_count_locks':
fs/ceph/locks.c:380:27: error: unused variable 'lock' [-Werror=unused-variable]
  380 |         struct file_lock *lock;

Rather than working around this in ceph, change the macro definition
to still contain a reference to the variable in order to shut up the
warning.

Fixes: 75cabec0111b ("filelock: add some new helper functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/filelock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index aabd4bdf7eba..69290173280a 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -283,7 +283,7 @@ static inline void locks_wake_up(struct file_lock *fl)
 {
 }
 
-#define for_each_file_lock(_fl, _head)	while(false)
+#define for_each_file_lock(_fl, _head)	while((void)_fl, false)
 
 static inline void
 locks_free_lock_context(struct inode *inode)
-- 
2.39.2


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

* Re: [PATCH] filelock: ignore 'lock' argument to for_each_file_lock()
  2024-02-12 11:26 [PATCH] filelock: ignore 'lock' argument to for_each_file_lock() Arnd Bergmann
@ 2024-02-12 12:07 ` Christian Brauner
  2024-02-12 12:08 ` Jeff Layton
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-02-12 12:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: NeilBrown, Jeff Layton, Arnd Bergmann, Luca Vizzarro, Tom Talpey,
	linux-kernel

On Mon, Feb 12, 2024 at 12:26:11PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When CONFIG_FILE_LOCKING is disabled, ceph causes a warning about
> a variable that is only used insode of the for_each_file_lock()
> loop:
> 
> fs/ceph/locks.c: In function 'ceph_count_locks':
> fs/ceph/locks.c:380:27: error: unused variable 'lock' [-Werror=unused-variable]
>   380 |         struct file_lock *lock;
> 
> Rather than working around this in ceph, change the macro definition
> to still contain a reference to the variable in order to shut up the
> warning.
> 
> Fixes: 75cabec0111b ("filelock: add some new helper functions")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Yup, seems good to me.

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

* Re: [PATCH] filelock: ignore 'lock' argument to for_each_file_lock()
  2024-02-12 11:26 [PATCH] filelock: ignore 'lock' argument to for_each_file_lock() Arnd Bergmann
  2024-02-12 12:07 ` Christian Brauner
@ 2024-02-12 12:08 ` Jeff Layton
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2024-02-12 12:08 UTC (permalink / raw)
  To: Arnd Bergmann, NeilBrown, Christian Brauner
  Cc: Arnd Bergmann, Luca Vizzarro, Tom Talpey, linux-kernel

On Mon, 2024-02-12 at 12:26 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When CONFIG_FILE_LOCKING is disabled, ceph causes a warning about
> a variable that is only used insode of the for_each_file_lock()
> loop:
> 
> fs/ceph/locks.c: In function 'ceph_count_locks':
> fs/ceph/locks.c:380:27: error: unused variable 'lock' [-Werror=unused-variable]
>   380 |         struct file_lock *lock;
> 
> Rather than working around this in ceph, change the macro definition
> to still contain a reference to the variable in order to shut up the
> warning.
> 
> Fixes: 75cabec0111b ("filelock: add some new helper functions")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/filelock.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/filelock.h b/include/linux/filelock.h
> index aabd4bdf7eba..69290173280a 100644
> --- a/include/linux/filelock.h
> +++ b/include/linux/filelock.h
> @@ -283,7 +283,7 @@ static inline void locks_wake_up(struct file_lock *fl)
>  {
>  }
>  
> -#define for_each_file_lock(_fl, _head)	while(false)
> +#define for_each_file_lock(_fl, _head)	while((void)_fl, false)
>  
>  static inline void
>  locks_free_lock_context(struct inode *inode)

I had sent a patch early last week for this, but then dropped the ball
on following up. The simpler fix is to just unconditionally define
for_each_file_lock(). It's a macro, so we can just move the "real"
definition outside of the #ifdef.

I'll spin up a patch later today and resend it.

Thanks,
-- 
Jeff Layton <jlayton@kernel.org>

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

end of thread, other threads:[~2024-02-12 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 11:26 [PATCH] filelock: ignore 'lock' argument to for_each_file_lock() Arnd Bergmann
2024-02-12 12:07 ` Christian Brauner
2024-02-12 12:08 ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®