aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2018-10-12 06:08:43 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-25 13:17:40 -0400
commita91e138022bc29b5d2bbc56b41de3e0db6261e28 (patch)
tree858cb365d8459eed119c9e51371ee25d99d53e2a /include/linux/blkdev.h
parent5f832a395859de7191e638e3777ae57f37d46d08 (diff)
block: Introduce blkdev_nr_zones() helper
Introduce the blkdev_nr_zones() helper function to get the total number of zones of a zoned block device. This number is always 0 for a regular block device (q->limits.zoned == BLK_ZONED_NONE case). Replace hard-coded number of zones calculation in dmz_get_zoned_device() with a call to this helper. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7d423721b327..ca5fdc1b7745 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -401,6 +401,7 @@ struct blk_zone_report_hdr {
401 u8 padding[60]; 401 u8 padding[60];
402}; 402};
403 403
404extern unsigned int blkdev_nr_zones(struct block_device *bdev);
404extern int blkdev_report_zones(struct block_device *bdev, 405extern int blkdev_report_zones(struct block_device *bdev,
405 sector_t sector, struct blk_zone *zones, 406 sector_t sector, struct blk_zone *zones,
406 unsigned int *nr_zones, gfp_t gfp_mask); 407 unsigned int *nr_zones, gfp_t gfp_mask);
@@ -414,6 +415,10 @@ extern int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode,
414 415
415#else /* CONFIG_BLK_DEV_ZONED */ 416#else /* CONFIG_BLK_DEV_ZONED */
416 417
418static inline unsigned int blkdev_nr_zones(struct block_device *bdev)
419{
420 return 0;
421}
417static inline int blkdev_report_zones_ioctl(struct block_device *bdev, 422static inline int blkdev_report_zones_ioctl(struct block_device *bdev,
418 fmode_t mode, unsigned int cmd, 423 fmode_t mode, unsigned int cmd,
419 unsigned long arg) 424 unsigned long arg)