Skip to content

Commit 72cd875

Browse files
damien-lemoalaxboe
authored andcommitted
block: Introduce BLKGETZONESZ ioctl
Get a zoned block device zone size in number of 512 B sectors. The zone size is always 0 for regular block devices. Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2e85fba commit 72cd875

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

block/ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
532532
return blkdev_report_zones_ioctl(bdev, mode, cmd, arg);
533533
case BLKRESETZONE:
534534
return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg);
535+
case BLKGETZONESZ:
536+
return put_uint(arg, bdev_zone_sectors(bdev));
535537
case HDIO_GETGEO:
536538
return blkdev_getgeo(bdev, argp);
537539
case BLKRAGET:

include/uapi/linux/blkzoned.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ struct blk_zone_range {
137137
* sector specified in the report request structure.
138138
* @BLKRESETZONE: Reset the write pointer of the zones in the specified
139139
* sector range. The sector range must be zone aligned.
140+
* @BLKGETZONESZ: Get the device zone size in number of 512 B sectors.
140141
*/
141142
#define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report)
142143
#define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range)
144+
#define BLKGETZONESZ _IOW(0x12, 132, __u32)
143145

144146
#endif /* _UAPI_BLKZONED_H */

0 commit comments

Comments
 (0)