Skip to content

Commit 582a3bf

Browse files
jtlaytonbrauner
authored andcommitted
filelock: always define for_each_file_lock()
...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: 75cabec ("filelock: add some new helper functions") Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://lore.kernel.org/r/20240212-flsplit3-v1-1-019f0ad6bf69@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 292fcaa commit 582a3bf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

include/linux/filelock.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ static inline void locks_wake_up(struct file_lock *fl)
180180
wake_up(&fl->c.flc_wait);
181181
}
182182

183-
/* for walking lists of file_locks linked by fl_list */
184-
#define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, c.flc_list)
185-
186183
/* fs/locks.c */
187184
void locks_free_lock_context(struct inode *inode);
188185
void locks_free_lock(struct file_lock *fl);
@@ -283,8 +280,6 @@ static inline void locks_wake_up(struct file_lock *fl)
283280
{
284281
}
285282

286-
#define for_each_file_lock(_fl, _head) while(false)
287-
288283
static inline void
289284
locks_free_lock_context(struct inode *inode)
290285
{
@@ -414,6 +409,9 @@ locks_inode_context(const struct inode *inode)
414409

415410
#endif /* !CONFIG_FILE_LOCKING */
416411

412+
/* for walking lists of file_locks linked by fl_list */
413+
#define for_each_file_lock(_fl, _head) list_for_each_entry(_fl, _head, c.flc_list)
414+
417415
static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
418416
{
419417
return locks_lock_inode_wait(file_inode(filp), fl);

0 commit comments

Comments
 (0)