[mcgrof-next:20220707-dm-zoned-npo2 10/13] drivers/md/dm-table.c:253:40: error: passing argument 1 of 'bdev_is_zone_start' from incompatible pointer type

From: kernel test robot
Date: Sat Jul 09 2022 - 02:20:45 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20220707-dm-zoned-npo2
head: 3d1b6e41f76394610669e380da4f65bc5e7cf8ac
commit: d7a44aa426f271934d5539d39454ef3acc45f9d8 [10/13] dm-table: use bdev_is_zone_start helper in device_area_is_invalid()
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220709/202207091412.HaT3RYs0-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=d7a44aa426f271934d5539d39454ef3acc45f9d8
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20220707-dm-zoned-npo2
git checkout d7a44aa426f271934d5539d39454ef3acc45f9d8
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

drivers/md/dm-table.c: In function 'device_area_is_invalid':
drivers/md/dm-table.c:251:45: error: implicit declaration of function 'bdev_zone_sectors'; did you mean 'bdev_nr_sectors'? [-Werror=implicit-function-declaration]
251 | unsigned int zone_sectors = bdev_zone_sectors(bdev);
| ^~~~~~~~~~~~~~~~~
| bdev_nr_sectors
>> drivers/md/dm-table.c:253:40: error: passing argument 1 of 'bdev_is_zone_start' from incompatible pointer type [-Werror=incompatible-pointer-types]
253 | if (bdev_is_zone_start(bdev, start)) {
| ^~~~
| |
| struct block_device *
In file included from include/linux/blk-mq.h:5,
from drivers/md/dm-core.h:14,
from drivers/md/dm-table.c:8:
include/linux/blkdev.h:772:55: note: expected 'struct gendisk *' but argument is of type 'struct block_device *'
772 | static inline bool bdev_is_zone_start(struct gendisk *disk, sector_t sec)
| ~~~~~~~~~~~~~~~~^~~~
drivers/md/dm-table.c:270:40: error: passing argument 1 of 'bdev_is_zone_start' from incompatible pointer type [-Werror=incompatible-pointer-types]
270 | if (bdev_is_zone_start(bdev, len)) {
| ^~~~
| |
| struct block_device *
In file included from include/linux/blk-mq.h:5,
from drivers/md/dm-core.h:14,
from drivers/md/dm-table.c:8:
include/linux/blkdev.h:772:55: note: expected 'struct gendisk *' but argument is of type 'struct block_device *'
772 | static inline bool bdev_is_zone_start(struct gendisk *disk, sector_t sec)
| ~~~~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors


vim +/bdev_is_zone_start +253 drivers/md/dm-table.c

220
221 /*
222 * If possible, this checks an area of a destination device is invalid.
223 */
224 static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
225 sector_t start, sector_t len, void *data)
226 {
227 struct queue_limits *limits = data;
228 struct block_device *bdev = dev->bdev;
229 sector_t dev_size = bdev_nr_sectors(bdev);
230 unsigned short logical_block_size_sectors =
231 limits->logical_block_size >> SECTOR_SHIFT;
232
233 if (!dev_size)
234 return 0;
235
236 if ((start >= dev_size) || (start + len > dev_size)) {
237 DMWARN("%s: %pg too small for target: "
238 "start=%llu, len=%llu, dev_size=%llu",
239 dm_device_name(ti->table->md), bdev,
240 (unsigned long long)start,
241 (unsigned long long)len,
242 (unsigned long long)dev_size);
243 return 1;
244 }
245
246 /*
247 * If the target is mapped to zoned block device(s), check
248 * that the zones are not partially mapped.
249 */
250 if (bdev_is_zoned(bdev)) {
251 unsigned int zone_sectors = bdev_zone_sectors(bdev);
252
> 253 if (bdev_is_zone_start(bdev, start)) {
254 DMWARN("%s: start=%llu not aligned to h/w zone size %u of %pg",
255 dm_device_name(ti->table->md),
256 (unsigned long long)start,
257 zone_sectors, bdev);
258 return 1;
259 }
260
261 /*
262 * Note: The last zone of a zoned block device may be smaller
263 * than other zones. So for a target mapping the end of a
264 * zoned block device with such a zone, len would not be zone
265 * aligned. We do not allow such last smaller zone to be part
266 * of the mapping here to ensure that mappings with multiple
267 * devices do not end up with a smaller zone in the middle of
268 * the sector range.
269 */
270 if (bdev_is_zone_start(bdev, len)) {
271 DMWARN("%s: len=%llu not aligned to h/w zone size %u of %pg",
272 dm_device_name(ti->table->md),
273 (unsigned long long)len,
274 zone_sectors, bdev);
275 return 1;
276 }
277 }
278
279 if (logical_block_size_sectors <= 1)
280 return 0;
281
282 if (start & (logical_block_size_sectors - 1)) {
283 DMWARN("%s: start=%llu not aligned to h/w "
284 "logical block size %u of %pg",
285 dm_device_name(ti->table->md),
286 (unsigned long long)start,
287 limits->logical_block_size, bdev);
288 return 1;
289 }
290
291 if (len & (logical_block_size_sectors - 1)) {
292 DMWARN("%s: len=%llu not aligned to h/w "
293 "logical block size %u of %pg",
294 dm_device_name(ti->table->md),
295 (unsigned long long)len,
296 limits->logical_block_size, bdev);
297 return 1;
298 }
299
300 return 0;
301 }
302

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