diff mbox series

[v3,07/11] block: Introduce BLKGETNRZONES ioctl

Message ID 20181012023012.29923-8-damien.lemoal@wdc.com (mailing list archive)
State New, archived
Headers show
Series Zoned block device support improvements | expand

Commit Message

Damien Le Moal Oct. 12, 2018, 2:30 a.m. UTC
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.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/ioctl.c                 | 2 ++
 include/uapi/linux/blkzoned.h | 1 +
 2 files changed, 3 insertions(+)

Comments

Hannes Reinecke Oct. 12, 2018, 7:37 a.m. UTC | #1
On 10/12/18 4:30 AM, Damien Le Moal wrote:
> 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.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>   block/ioctl.c                 | 2 ++
>   include/uapi/linux/blkzoned.h | 1 +
>   2 files changed, 3 insertions(+)
> 
And that's us, trying to get rid of ioctls ...

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers

Hannes
Christoph Hellwig Oct. 12, 2018, 8:23 a.m. UTC | #2
On Fri, Oct 12, 2018 at 11:30:08AM +0900, Damien Le Moal wrote:
> 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.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/block/ioctl.c b/block/ioctl.c
index f6d2c6f1f050..4825c78a6baa 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -534,6 +534,8 @@  int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
 		return blkdev_reset_zones_ioctl(bdev, mode, cmd, arg);
 	case BLKGETZONESZ:
 		return put_uint(arg, bdev_zone_sectors(bdev));
+	case BLKGETNRZONES:
+		return put_uint(arg, blkdev_nr_zones(bdev));
 	case HDIO_GETGEO:
 		return blkdev_getgeo(bdev, argp);
 	case BLKRAGET:
diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
index 281ac605f752..8f08ff9bdea0 100644
--- a/include/uapi/linux/blkzoned.h
+++ b/include/uapi/linux/blkzoned.h
@@ -142,5 +142,6 @@  struct blk_zone_range {
 #define BLKREPORTZONE	_IOWR(0x12, 130, struct blk_zone_report)
 #define BLKRESETZONE	_IOW(0x12, 131, struct blk_zone_range)
 #define BLKGETZONESZ	_IOW(0x12, 132, __u32)
+#define BLKGETNRZONES	_IOW(0x12, 133, __u32)
 
 #endif /* _UAPI_BLKZONED_H */