[jlayton:ceph-netfs-llist 26/51] fs/netfs/output.c:274:32: warning: unused variable 'cookie'

From: kernel test robot
Date: Thu May 19 2022 - 01:32:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git ceph-netfs-llist
head: 33ef80e1351d57c7496e3dfb6974767f4493dd91
commit: 7bf4565326b2233dacf25020fc700d70a231a694 [26/51] netfs: Dispatch write requests to process a writeback slice
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220519/202205191357.rJyD2yOh-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?id=7bf4565326b2233dacf25020fc700d70a231a694
git remote add jlayton https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git
git fetch --no-tags jlayton ceph-netfs-llist
git checkout 7bf4565326b2233dacf25020fc700d70a231a694
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/netfs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/netfs/output.c: In function 'netfs_set_up_write_to_cache':
>> fs/netfs/output.c:274:32: warning: unused variable 'cookie' [-Wunused-variable]
274 | struct fscache_cookie *cookie = netfs_i_cookie(wreq->inode);
| ^~~~~~


vim +/cookie +274 fs/netfs/output.c

266
267 /*
268 * Set up a op for writing to the cache.
269 */
270 static void netfs_set_up_write_to_cache(struct netfs_io_request *wreq)
271 {
272 struct netfs_cache_resources *cres;
273 struct netfs_io_subrequest *subreq;
> 274 struct fscache_cookie *cookie = netfs_i_cookie(wreq->inode);
275 loff_t start = wreq->first * PAGE_SIZE;
276 size_t len = (wreq->last - wreq->first + 1) * PAGE_SIZE;
277 int ret;
278
279 if (!fscache_cookie_enabled(cookie)) {
280 clear_bit(NETFS_RREQ_WRITE_TO_CACHE, &wreq->flags);
281 return;
282 }
283
284 _debug("write to cache");
285 subreq = netfs_create_write_request(wreq, NETFS_WRITE_TO_CACHE, start, len,
286 netfs_write_to_cache_op_worker);
287 if (!subreq)
288 return;
289
290 cres = &wreq->cache_resources;
291 ret = -ENOBUFS;
292 if (wreq->netfs_ops->begin_cache_operation)
293 ret = wreq->netfs_ops->begin_cache_operation(wreq);
294 if (ret < 0) {
295 netfs_write_subrequest_terminated(subreq, ret, false);
296 return;
297 }
298
299 ret = cres->ops->prepare_write(cres, &start, &len, i_size_read(wreq->inode),
300 true);
301 if (ret < 0) {
302 netfs_write_subrequest_terminated(subreq, ret, false);
303 return;
304 }
305
306 netfs_queue_write_request(subreq);
307 }
308

--
0-DAY CI Kernel Test Service
https://01.org/lkp