diff options
| -rw-r--r-- | block/blk-zoned.c | 1 | ||||
| -rw-r--r-- | drivers/block/null_blk_zoned.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/sd_zbc.c | 1 | ||||
| -rw-r--r-- | include/uapi/linux/blkzoned.h | 15 | 
4 files changed, 17 insertions, 2 deletions
diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 23831fa8701d..81152a260354 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -312,6 +312,7 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,  		return ret;  	rep.nr_zones = ret; +	rep.flags = BLK_ZONE_REP_CAPACITY;  	if (copy_to_user(argp, &rep, sizeof(struct blk_zone_report)))  		return -EFAULT;  	return 0; diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c index cc47606d8ffe..624aac09b005 100644 --- a/drivers/block/null_blk_zoned.c +++ b/drivers/block/null_blk_zoned.c @@ -47,6 +47,7 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)  		zone->start = sector;  		zone->len = dev->zone_size_sects; +		zone->capacity = zone->len;  		zone->wp = zone->start + zone->len;  		zone->type = BLK_ZONE_TYPE_CONVENTIONAL;  		zone->cond = BLK_ZONE_COND_NOT_WP; @@ -59,6 +60,7 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)  		zone->start = zone->wp = sector;  		zone->len = dev->zone_size_sects; +		zone->capacity = zone->len;  		zone->type = BLK_ZONE_TYPE_SEQWRITE_REQ;  		zone->cond = BLK_ZONE_COND_EMPTY; diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 6f7eba66687e..183a20720da9 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -59,6 +59,7 @@ static int sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,  		zone.non_seq = 1;  	zone.len = logical_to_sectors(sdp, get_unaligned_be64(&buf[8])); +	zone.capacity = zone.len;  	zone.start = logical_to_sectors(sdp, get_unaligned_be64(&buf[16]));  	zone.wp = logical_to_sectors(sdp, get_unaligned_be64(&buf[24]));  	if (zone.type != ZBC_ZONE_TYPE_CONV && diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h index 0cdef67135f0..42c3366cc25f 100644 --- a/include/uapi/linux/blkzoned.h +++ b/include/uapi/linux/blkzoned.h @@ -74,6 +74,15 @@ enum blk_zone_cond {  };  /** + * enum blk_zone_report_flags - Feature flags of reported zone descriptors. + * + * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field. + */ +enum blk_zone_report_flags { +	BLK_ZONE_REP_CAPACITY	= (1 << 0), +}; + +/**   * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.   *   * @start: Zone start in 512 B sector units @@ -99,7 +108,9 @@ struct blk_zone {  	__u8	cond;		/* Zone condition */  	__u8	non_seq;	/* Non-sequential write resources active */  	__u8	reset;		/* Reset write pointer recommended */ -	__u8	reserved[36]; +	__u8	resv[4]; +	__u64	capacity;	/* Zone capacity in number of sectors */ +	__u8	reserved[24];  };  /** @@ -115,7 +126,7 @@ struct blk_zone {  struct blk_zone_report {  	__u64		sector;  	__u32		nr_zones; -	__u8		reserved[4]; +	__u32		flags;  	struct blk_zone zones[0];  };  | 
