Skip to contentSkip to conversation

fs/ceph/locks.c:379:27: warning: unused variable 'lock'

PATCH kernel test robot 1 participant 1 message Feb 6, 2024 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ac139fc7db67968e5061715508b5fc4aa7c40c56
commit: 75e9570c93c70e8ad7be59cce82cea3872d8e8a7 [4030/4465] ceph: convert to using new filelock helpers
config: arm-randconfig-r071-20240206 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

fs/ceph/locks.c: In function 'ceph_count_locks':

>> fs/ceph/locks.c:379:27: warning: unused variable 'lock' [-Wunused-variable]
     379 |         struct file_lock *lock;
         |                           ^~~~

vim +/lock +379 fs/ceph/locks.c

40819f6fb227c1 Greg Farnum 2010-08-02  371  
5263e31e452fb8 Jeff Layton 2015-01-16  372  /*
5263e31e452fb8 Jeff Layton 2015-01-16  373   * Fills in the passed counter variables, so you can prepare pagelist metadata
5263e31e452fb8 Jeff Layton 2015-01-16  374   * before calling ceph_encode_locks.
40819f6fb227c1 Greg Farnum 2010-08-02  375   */
40819f6fb227c1 Greg Farnum 2010-08-02  376  void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
40819f6fb227c1 Greg Farnum 2010-08-02  377  {
38d46409c4639a Xiubo Li    2023-06-12  378  	struct ceph_client *cl = ceph_inode_to_client(inode);
e084c1bd409269 Jeff Layton 2015-02-16 @379  	struct file_lock *lock;
5263e31e452fb8 Jeff Layton 2015-01-16  380  	struct file_lock_context *ctx;
40819f6fb227c1 Greg Farnum 2010-08-02  381  
40819f6fb227c1 Greg Farnum 2010-08-02  382  	*fcntl_count = 0;
40819f6fb227c1 Greg Farnum 2010-08-02  383  	*flock_count = 0;
40819f6fb227c1 Greg Farnum 2010-08-02  384  
d4e78663f6bc83 Jeff Layton 2022-11-16  385  	ctx = locks_inode_context(inode);
5263e31e452fb8 Jeff Layton 2015-01-16  386  	if (ctx) {
e084c1bd409269 Jeff Layton 2015-02-16  387  		spin_lock(&ctx->flc_lock);
75e9570c93c70e Jeff Layton 2024-01-31  388  		for_each_file_lock(lock, &ctx->flc_posix)
e084c1bd409269 Jeff Layton 2015-02-16  389  			++(*fcntl_count);
75e9570c93c70e Jeff Layton 2024-01-31  390  		for_each_file_lock(lock, &ctx->flc_flock)
e084c1bd409269 Jeff Layton 2015-02-16  391  			++(*flock_count);
e084c1bd409269 Jeff Layton 2015-02-16  392  		spin_unlock(&ctx->flc_lock);
bd61e0a9c852de Jeff Layton 2015-01-16  393  	}
38d46409c4639a Xiubo Li    2023-06-12  394  	doutc(cl, "counted %d flock locks and %d fcntl locks\n",
40819f6fb227c1 Greg Farnum 2010-08-02  395  	      *flock_count, *fcntl_count);
40819f6fb227c1 Greg Farnum 2010-08-02  396  }
40819f6fb227c1 Greg Farnum 2010-08-02  397  

:::::: The code at line 379 was first introduced by commit
:::::: e084c1bd40926938ff8d26af3bde34396dd4d06d Revert "locks: keep a count of locks on the flctx lists"

:::::: TO: Jeff Layton <[email protected]> :::::: CC: Jeff Layton <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki