Re: [PATCH 6/8] loop: relax loop dio use condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ming,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.15-rc6]
[cannot apply to axboe-block/for-next next-20211026]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ming-Lei/loop-improve-dio-on-backing-file/20211025-174819
base:    519d81956ee277b4419c723adfb154603c2565ba
config: parisc-buildonly-randconfig-r002-20211026 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/f98a33d68a04634ba8f8314e9da480abc332b1f4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ming-Lei/loop-improve-dio-on-backing-file/20211025-174819
        git checkout f98a33d68a04634ba8f8314e9da480abc332b1f4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc 

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

All errors (new ones prefixed by >>):

   drivers/block/loop.c: In function 'loop_configure':
>> drivers/block/loop.c:1133:23: error: variable 'inode' set but not used [-Werror=unused-but-set-variable]
    1133 |         struct inode *inode;
         |                       ^~~~~
   cc1: all warnings being treated as errors


vim +/inode +1133 drivers/block/loop.c

62ab466ca881fe2 Martijn Coenen      2020-05-13  1127  
3448914e8cc550b Martijn Coenen      2020-05-13  1128  static int loop_configure(struct loop_device *lo, fmode_t mode,
3448914e8cc550b Martijn Coenen      2020-05-13  1129  			  struct block_device *bdev,
3448914e8cc550b Martijn Coenen      2020-05-13  1130  			  const struct loop_config *config)
^1da177e4c3f415 Linus Torvalds      2005-04-16  1131  {
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1132  	struct file *file = fget(config->fd);
^1da177e4c3f415 Linus Torvalds      2005-04-16 @1133  	struct inode *inode;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1134  	struct address_space *mapping;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1135  	int error;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1136  	loff_t size;
85b0a54a82e4fbc Jan Kara            2018-11-08  1137  	bool partscan;
3448914e8cc550b Martijn Coenen      2020-05-13  1138  	unsigned short bsize;
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1139  	bool is_loop;
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1140  
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1141  	if (!file)
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1142  		return -EBADF;
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1143  	is_loop = is_loop_device(file);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1144  
^1da177e4c3f415 Linus Torvalds      2005-04-16  1145  	/* This is safe, since we have a reference from open(). */
^1da177e4c3f415 Linus Torvalds      2005-04-16  1146  	__module_get(THIS_MODULE);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1147  
33ec3e53e7b1869 Jan Kara            2019-05-16  1148  	/*
33ec3e53e7b1869 Jan Kara            2019-05-16  1149  	 * If we don't hold exclusive handle for the device, upgrade to it
33ec3e53e7b1869 Jan Kara            2019-05-16  1150  	 * here to avoid changing device under exclusive owner.
33ec3e53e7b1869 Jan Kara            2019-05-16  1151  	 */
33ec3e53e7b1869 Jan Kara            2019-05-16  1152  	if (!(mode & FMODE_EXCL)) {
37c3fc9abb25cd7 Christoph Hellwig   2020-11-25  1153  		error = bd_prepare_to_claim(bdev, loop_configure);
ecbe6bc0003bfd5 Christoph Hellwig   2020-07-16  1154  		if (error)
757ecf40b7e0295 Jan Kara            2018-11-08  1155  			goto out_putf;
33ec3e53e7b1869 Jan Kara            2019-05-16  1156  	}
33ec3e53e7b1869 Jan Kara            2019-05-16  1157  
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1158  	error = loop_global_lock_killable(lo, is_loop);
33ec3e53e7b1869 Jan Kara            2019-05-16  1159  	if (error)
33ec3e53e7b1869 Jan Kara            2019-05-16  1160  		goto out_bdev;
757ecf40b7e0295 Jan Kara            2018-11-08  1161  
^1da177e4c3f415 Linus Torvalds      2005-04-16  1162  	error = -EBUSY;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1163  	if (lo->lo_state != Lo_unbound)
757ecf40b7e0295 Jan Kara            2018-11-08  1164  		goto out_unlock;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1165  
d2ac838e4cd7e5e Theodore Ts'o       2018-05-07  1166  	error = loop_validate_file(file, bdev);
d2ac838e4cd7e5e Theodore Ts'o       2018-05-07  1167  	if (error)
757ecf40b7e0295 Jan Kara            2018-11-08  1168  		goto out_unlock;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1169  
^1da177e4c3f415 Linus Torvalds      2005-04-16  1170  	mapping = file->f_mapping;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1171  	inode = mapping->host;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1172  
3448914e8cc550b Martijn Coenen      2020-05-13  1173  	if ((config->info.lo_flags & ~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
3448914e8cc550b Martijn Coenen      2020-05-13  1174  		error = -EINVAL;
3448914e8cc550b Martijn Coenen      2020-05-13  1175  		goto out_unlock;
3448914e8cc550b Martijn Coenen      2020-05-13  1176  	}
3448914e8cc550b Martijn Coenen      2020-05-13  1177  
3448914e8cc550b Martijn Coenen      2020-05-13  1178  	if (config->block_size) {
3448914e8cc550b Martijn Coenen      2020-05-13  1179  		error = loop_validate_block_size(config->block_size);
3448914e8cc550b Martijn Coenen      2020-05-13  1180  		if (error)
3448914e8cc550b Martijn Coenen      2020-05-13  1181  			goto out_unlock;
3448914e8cc550b Martijn Coenen      2020-05-13  1182  	}
3448914e8cc550b Martijn Coenen      2020-05-13  1183  
3448914e8cc550b Martijn Coenen      2020-05-13  1184  	error = loop_set_status_from_info(lo, &config->info);
3448914e8cc550b Martijn Coenen      2020-05-13  1185  	if (error)
3448914e8cc550b Martijn Coenen      2020-05-13  1186  		goto out_unlock;
3448914e8cc550b Martijn Coenen      2020-05-13  1187  
456be1484ffc72a Christoph Hellwig   2011-10-17  1188  	if (!(file->f_mode & FMODE_WRITE) || !(mode & FMODE_WRITE) ||
283e7e5d249f486 Al Viro             2015-04-03  1189  	    !file->f_op->write_iter)
3448914e8cc550b Martijn Coenen      2020-05-13  1190  		lo->lo_flags |= LO_FLAGS_READ_ONLY;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1191  
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1192  	lo->workqueue = alloc_workqueue("loop%d",
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1193  					WQ_UNBOUND | WQ_FREEZABLE,
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1194  					0,
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1195  					lo->lo_number);
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1196  	if (!lo->workqueue) {
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1197  		error = -ENOMEM;
757ecf40b7e0295 Jan Kara            2018-11-08  1198  		goto out_unlock;
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1199  	}
^1da177e4c3f415 Linus Torvalds      2005-04-16  1200  
9f65c489b68d424 Matteo Croce        2021-07-13  1201  	disk_force_media_change(lo->lo_disk, DISK_EVENT_MEDIA_CHANGE);
7a2f0ce19f2e2ed Christoph Hellwig   2020-11-03  1202  	set_disk_ro(lo->lo_disk, (lo->lo_flags & LO_FLAGS_READ_ONLY) != 0);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1203  
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1204  	INIT_WORK(&lo->rootcg_work, loop_rootcg_workfn);
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1205  	INIT_LIST_HEAD(&lo->rootcg_cmd_list);
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1206  	INIT_LIST_HEAD(&lo->idle_worker_list);
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1207  	lo->worker_tree = RB_ROOT;
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1208  	timer_setup(&lo->timer, loop_free_idle_workers,
87579e9b7d8dc36 Dan Schatzberg      2021-06-28  1209  		TIMER_DEFERRABLE);
3448914e8cc550b Martijn Coenen      2020-05-13  1210  	lo->use_dio = lo->lo_flags & LO_FLAGS_DIRECT_IO;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1211  	lo->lo_device = bdev;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1212  	lo->lo_backing_file = file;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1213  	lo->old_gfp_mask = mapping_gfp_mask(mapping);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1214  	mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
^1da177e4c3f415 Linus Torvalds      2005-04-16  1215  
3448914e8cc550b Martijn Coenen      2020-05-13  1216  	if (!(lo->lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync)
21d0727f639e4ba Jens Axboe          2016-03-30  1217  		blk_queue_write_cache(lo->lo_queue, true, false);
68db1961bbf4e16 Nikanth Karthikesan 2009-03-24  1218  
3448914e8cc550b Martijn Coenen      2020-05-13  1219  	if (config->block_size)
3448914e8cc550b Martijn Coenen      2020-05-13  1220  		bsize = config->block_size;
3448914e8cc550b Martijn Coenen      2020-05-13  1221  	else
3448914e8cc550b Martijn Coenen      2020-05-13  1222  		bsize = 512;
85560117d00f5d5 Martijn Coenen      2019-09-04  1223  
85560117d00f5d5 Martijn Coenen      2019-09-04  1224  	blk_queue_logical_block_size(lo->lo_queue, bsize);
85560117d00f5d5 Martijn Coenen      2019-09-04  1225  	blk_queue_physical_block_size(lo->lo_queue, bsize);
85560117d00f5d5 Martijn Coenen      2019-09-04  1226  	blk_queue_io_min(lo->lo_queue, bsize);
85560117d00f5d5 Martijn Coenen      2019-09-04  1227  
2b9ac22b12a266e Kristian Klausen    2021-06-18  1228  	loop_config_discard(lo);
56a85fd8376ef32 Holger Hoffstätte   2019-02-12  1229  	loop_update_rotational(lo);
2e5ab5f379f96a6 Ming Lei            2015-08-17  1230  	loop_update_dio(lo);
ee86273062cbb31 Milan Broz          2010-08-23  1231  	loop_sysfs_init(lo);
79e5dc59e2974a4 Martijn Coenen      2020-08-25  1232  
79e5dc59e2974a4 Martijn Coenen      2020-08-25  1233  	size = get_loop_size(lo, file);
5795b6f5607f7e4 Martijn Coenen      2020-05-13  1234  	loop_set_size(lo, size);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1235  
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1236  	/* Order wrt reading lo_state in loop_validate_file(). */
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1237  	wmb();
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1238  
6c9979185c7ef4f Serge E. Hallyn     2006-09-29  1239  	lo->lo_state = Lo_bound;
e03c8dd14915fab Kay Sievers         2011-08-23  1240  	if (part_shift)
e03c8dd14915fab Kay Sievers         2011-08-23  1241  		lo->lo_flags |= LO_FLAGS_PARTSCAN;
85b0a54a82e4fbc Jan Kara            2018-11-08  1242  	partscan = lo->lo_flags & LO_FLAGS_PARTSCAN;
fe6a8fc5ed2f008 Lennart Poettering  2020-08-10  1243  	if (partscan)
fe6a8fc5ed2f008 Lennart Poettering  2020-08-10  1244  		lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN;
c1681bf8a7b1b98 Anatol Pomozov      2013-04-01  1245  
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1246  	loop_global_unlock(lo, is_loop);
85b0a54a82e4fbc Jan Kara            2018-11-08  1247  	if (partscan)
0384264ea8a39bd Christoph Hellwig   2021-06-24  1248  		loop_reread_partitions(lo);
37c3fc9abb25cd7 Christoph Hellwig   2020-11-25  1249  	if (!(mode & FMODE_EXCL))
37c3fc9abb25cd7 Christoph Hellwig   2020-11-25  1250  		bd_abort_claiming(bdev, loop_configure);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1251  	return 0;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1252  
757ecf40b7e0295 Jan Kara            2018-11-08  1253  out_unlock:
3ce6e1f662a9109 Tetsuo Handa        2021-07-06  1254  	loop_global_unlock(lo, is_loop);
33ec3e53e7b1869 Jan Kara            2019-05-16  1255  out_bdev:
37c3fc9abb25cd7 Christoph Hellwig   2020-11-25  1256  	if (!(mode & FMODE_EXCL))
37c3fc9abb25cd7 Christoph Hellwig   2020-11-25  1257  		bd_abort_claiming(bdev, loop_configure);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1258  out_putf:
^1da177e4c3f415 Linus Torvalds      2005-04-16  1259  	fput(file);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1260  	/* This is safe: open() is still holding a reference. */
^1da177e4c3f415 Linus Torvalds      2005-04-16  1261  	module_put(THIS_MODULE);
^1da177e4c3f415 Linus Torvalds      2005-04-16  1262  	return error;
^1da177e4c3f415 Linus Torvalds      2005-04-16  1263  }
^1da177e4c3f415 Linus Torvalds      2005-04-16  1264  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux