block: Expose queue nr_zones in sysfs
authorDamien Le Moal <[email protected]>
Fri, 12 Oct 2018 10:08:48 +0000 (19:08 +0900)
committerJens Axboe <[email protected]>
Thu, 25 Oct 2018 17:17:40 +0000 (11:17 -0600)
commit965b652e901886ea54f93c60027b5be76328d958
tree3fc654b827875179138aeeeadd68fd1ebb287771
parenta2d6b3a2d39005ab4d4a83481a7db092ebf0e9d6
block: Expose queue nr_zones in sysfs

Expose through sysfs the nr_zones field of struct request_queue.
Exposing this value helps in debugging disk issues as well as
facilitating scripts based use of the disk (e.g. blktests).

For zoned block devices, the nr_zones field indicates the total number
of zones of the device calculated using the known disk capacity and
zone size. This number of zones is always 0 for regular block devices.

Since nr_zones is defined conditionally with CONFIG_BLK_DEV_ZONED,
introduce the blk_queue_nr_zones() function to return the correct value
for any device, regardless if CONFIG_BLK_DEV_ZONED is set.

Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Damien Le Moal <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
block/blk-sysfs.c
include/linux/blkdev.h