Skip to content

Commit 65e4e3e

Browse files
damien-lemoalaxboe
authored andcommitted
block: Introduce BLKGETNRZONES ioctl
Get a zoned block device total number of zones. The device can be a partition of the whole device. The number of zones is always 0 for regular block devices. Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 72cd875 commit 65e4e3e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

block/ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
534534
return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg);
535535
case BLKGETZONESZ:
536536
return put_uint(arg, bdev_zone_sectors(bdev));
537+
case BLKGETNRZONES:
538+
return put_uint(arg, blkdev_nr_zones(bdev));
537539
case HDIO_GETGEO:
538540
return blkdev_getgeo(bdev, argp);
539541
case BLKRAGET:

include/uapi/linux/blkzoned.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,6 @@ struct blk_zone_range {
142142
#define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report)
143143
#define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range)
144144
#define BLKGETZONESZ _IOW(0x12, 132, __u32)
145+
#define BLKGETNRZONES _IOW(0x12, 133, __u32)
145146

146147
#endif /* _UAPI_BLKZONED_H */

0 commit comments

Comments
 (0)