From: Jeff Layton <jlayton@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Arnd Bergmann <arnd@kernel.org>, Tom Talpey <tom@talpey.com>,
Luca Vizzarro <Luca.Vizzarro@arm.com>,
Chuck Lever <chuck.lever@oracle.com>,
Alexander Aring <aahringo@redhat.com>,
linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH] filelock: always define for_each_file_lock()
Date: Mon, 12 Feb 2024 07:24:05 -0500 [thread overview]
Message-ID: <20240212-flsplit3-v1-1-019f0ad6bf69@kernel.org> (raw)
...and eliminate the stub version when CONFIG_FILE_LOCKING is disabled.
This silences the following warning that crept in recently:
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;
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202402062210.3YyBVGF1-lkp@intel.com/
Fixes: 75cabec0111b ("filelock: add some new helper functions")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
include/linux/filelock.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index aabd4bdf7eba..daee999d05f3 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -180,9 +180,6 @@ static inline void locks_wake_up(struct file_lock *fl)
wake_up(&fl->c.flc_wait);
}
-/* for walking lists of file_locks linked by fl_list */
-#define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, c.flc_list)
-
/* fs/locks.c */
void locks_free_lock_context(struct inode *inode);
void locks_free_lock(struct file_lock *fl);
@@ -283,8 +280,6 @@ static inline void locks_wake_up(struct file_lock *fl)
{
}
-#define for_each_file_lock(_fl, _head) while(false)
-
static inline void
locks_free_lock_context(struct inode *inode)
{
@@ -414,6 +409,9 @@ locks_inode_context(const struct inode *inode)
#endif /* !CONFIG_FILE_LOCKING */
+/* for walking lists of file_locks linked by fl_list */
+#define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, c.flc_list)
+
static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
{
return locks_lock_inode_wait(file_inode(filp), fl);
---
base-commit: 292fcaa1f937345cb65f3af82a1ee6692c8df9eb
change-id: 20240212-flsplit3-174effe3675a
Best regards,
--
Jeff Layton <jlayton@kernel.org>
next reply other threads:[~2024-02-12 12:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 12:24 Jeff Layton [this message]
2024-02-12 13:09 ` [PATCH] filelock: always define for_each_file_lock() Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240212-flsplit3-v1-1-019f0ad6bf69@kernel.org \
--to=jlayton@kernel.org \
--cc=Luca.Vizzarro@arm.com \
--cc=aahringo@redhat.com \
--cc=arnd@kernel.org \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox