linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Himanshu Madhani <himanshu.madhani@oracle.com>
To: Keith Busch <kbusch@kernel.org>
Cc: linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me,
	linux-block@vger.kernel.org, axboe@kernel.dk,
	"Matias Bjørling" <matias.bjorling@wdc.com>,
	"Chaitanya Kulkarni" <chaitanya.kulkarni@wdc.com>,
	"Javier González" <javier.gonz@samsung.com>,
	"Daniel Wagner" <dwagner@suse.de>,
	"Johannes Thumshirn" <johannes.thumshirn@wdc.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	"Hannes Reinecke" <hare@suse.de>
Subject: Re: [PATCHv4 1/5] block: add capacity field to zone descriptors
Date: Tue, 30 Jun 2020 10:34:18 -0500	[thread overview]
Message-ID: <3598CF55-095F-477C-BEE2-93F11FAF44BD@oracle.com> (raw)
In-Reply-To: <20200629190641.1986462-2-kbusch@kernel.org>



> On Jun 29, 2020, at 2:06 PM, Keith Busch <kbusch@kernel.org> wrote:
> 
> From: Matias Bjørling <matias.bjorling@wdc.com>
> 
> In the zoned storage model, the sectors within a zone are typically all
> writeable. With the introduction of the Zoned Namespace (ZNS) Command
> Set in the NVM Express organization, the model was extended to have a
> specific writeable capacity.
> 
> Extend the zone descriptor data structure with a zone capacity field to
> indicate to the user how many sectors in a zone are writeable.
> 
> Introduce backward compatibility in the zone report ioctl by extending
> the zone report header data structure with a flags field to indicate if
> the capacity field is available.
> 
> Reviewed-by: Jens Axboe <axboe@kernel.dk>
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> Reviewed-by: Javier González <javier.gonz@samsung.com>
> Reviewed-by: Daniel Wagner <dwagner@suse.de>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> Signed-off-by: Matias Bjørling <matias.bjorling@wdc.com>
> ---
> block/blk-zoned.c              |  1 +
> drivers/block/null_blk_zoned.c |  2 ++
> drivers/scsi/sd_zbc.c          |  1 +
> 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
> @@ -73,6 +73,15 @@ enum blk_zone_cond {
> 	BLK_ZONE_COND_OFFLINE	= 0xF,
> };
> 
> +/**
> + * 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.
>  *
> @@ -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];
> };
> 
> -- 
> 2.24.1
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	Oracle Linux Engineering






  reply	other threads:[~2020-06-30 15:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 19:06 [PATCHv4 0/5] nvme support for zoned namespace command set Keith Busch
2020-06-29 19:06 ` [PATCHv4 1/5] block: add capacity field to zone descriptors Keith Busch
2020-06-30 15:34   ` Himanshu Madhani [this message]
2020-06-29 19:06 ` [PATCHv4 2/5] null_blk: introduce zone capacity for zoned device Keith Busch
2020-06-30 15:34   ` Himanshu Madhani
2020-06-29 19:06 ` [PATCHv4 3/5] nvme: implement I/O Command Sets Command Set support Keith Busch
2020-06-30  6:01   ` Hannes Reinecke
2020-06-30 15:45   ` Himanshu Madhani
2020-06-29 19:06 ` [PATCHv4 4/5] nvme: support for multi-command set effects Keith Busch
2020-06-30 15:51   ` Himanshu Madhani
2020-06-29 19:06 ` [PATCHv4 5/5] nvme: support for zoned namespaces Keith Busch
2020-06-30 16:36   ` Himanshu Madhani
2020-07-01  6:37 ` [PATCHv4 0/5] nvme support for zoned namespace command set Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3598CF55-095F-477C-BEE2-93F11FAF44BD@oracle.com \
    --to=himanshu.madhani@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=javier.gonz@samsung.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    --cc=matias.bjorling@wdc.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).