[PATCH V13 2/4] nvmet: add ZBD over ZNS backend support

Damien Le Moal Damien.LeMoal at wdc.com
Thu Apr 8 23:33:28 BST 2021


On 2021/04/09 7:06, Chaitanya Kulkarni wrote:
> On 4/8/21 01:01, Damien Le Moal wrote:
>>> +struct nvmet_report_zone_data {
>>> +	struct nvme_zone_report *rz;
>>> +	struct nvmet_ns *ns;
>>> +	u64 nr_zones;
>>> +	u8 zrasf;
>>> +};
>>> +
>>> +static int nvmet_bdev_report_zone_cb(struct blk_zone *z, unsigned i, void *d)
>>> +{
>>> +	struct nvmet_report_zone_data *rz = d;
>>> +	struct nvme_zone_descriptor *entries = rz->rz->entries;
>>> +	struct nvmet_ns *ns = rz->ns;
>>> +	static const unsigned int blk_zcond_to_nvme_zstate[] = {
>>> +		[BLK_ZONE_COND_EMPTY]	 = NVME_ZRASF_ZONE_STATE_EMPTY,
>>> +		[BLK_ZONE_COND_IMP_OPEN] = NVME_ZRASF_ZONE_STATE_IMP_OPEN,
>>> +		[BLK_ZONE_COND_EXP_OPEN] = NVME_ZRASF_ZONE_STATE_EXP_OPEN,
>>> +		[BLK_ZONE_COND_CLOSED]	 = NVME_ZRASF_ZONE_STATE_CLOSED,
>>> +		[BLK_ZONE_COND_READONLY] = NVME_ZRASF_ZONE_STATE_READONLY,
>>> +		[BLK_ZONE_COND_FULL]	 = NVME_ZRASF_ZONE_STATE_FULL,
>>> +		[BLK_ZONE_COND_OFFLINE]	 = NVME_ZRASF_ZONE_STATE_OFFLINE,
>>> +	};
>> This creates a sparse array bigger than it needs to be. If you reverse here and
>> use the ZRASF values as indexes (blk_zrasf_to_zcond[]), the array will shrink
>> and not be sparse, then... See below...
>>
>>> +
>>> +	if (rz->zrasf == NVME_ZRASF_ZONE_REPORT_ALL)
>>> +		goto record_zone;
>>> +
>>> +	/*
>>> +	 * Make sure this zone condition's value is mapped to NVMe ZNS zone
>>> +	 * condition value.
>>> +	 */
>>> +	if (z->cond > ARRAY_SIZE(blk_zcond_to_nvme_zstate) ||
>>> +	    !blk_zcond_to_nvme_zstate[z->cond])
>>> +		return -EINVAL;
>>> +
>>> +	/* filter zone by condition */
>>> +	if (blk_zcond_to_nvme_zstate[z->cond] != rz->zrasf)
>>> +		return 0;
>> ...since zrasf is already validated, all of the above becomes:
>>
>> 	/* filter zones by condition */
>> 	if (rz->zrasf != NVME_ZRASF_ZONE_REPORT_ALL &&
>> 	    z->cond != blk_zrasf_to_zcond[rz->zrasf])
>> 		return 0;
> 
> Since you are okay with this will make this change, except the array
> name should be:- nvme_zrasf_to_blk_zcond.
> 
>>> +
>>> +record_zone:
>> This label can go away too.
> 
> Yes.
> 
>>
>>> +
>>> +	entries[rz->nr_zones].zcap = nvmet_sect_to_lba(ns, z->capacity);
>>> +	entries[rz->nr_zones].zslba = nvmet_sect_to_lba(ns, z->start);
>>> +	entries[rz->nr_zones].wp = nvmet_sect_to_lba(ns, z->wp);
>>> +	entries[rz->nr_zones].za = z->reset ? 1 << 2 : 0;
>>> +	entries[rz->nr_zones].zs = z->cond << 4;
>>> +	entries[rz->nr_zones].zt = z->type;
>>> +
>>> +	rz->nr_zones++;
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +unsigned long nvmet_req_nr_zones_from_slba(struct nvmet_req *req)
> 
> [...]
> 
>>> +void nvmet_bdev_execute_zone_mgmt_send(struct nvmet_req *req)
>>> +{
>>> +	sector_t sect = nvmet_lba_to_sect(req->ns, req->cmd->zms.slba);
>>> +	u16 status = NVME_SC_SUCCESS;
>>> +	u8 zsa = req->cmd->zms.zsa;
>>> +	sector_t nr_sects;
>>> +	enum req_opf op;
>>> +	int ret;
>>> +	const unsigned int zsa_to_op[] = {
>>> +		[NVME_ZONE_OPEN]	= REQ_OP_ZONE_OPEN,
>>> +		[NVME_ZONE_CLOSE]	= REQ_OP_ZONE_CLOSE,
>>> +		[NVME_ZONE_FINISH]	= REQ_OP_ZONE_FINISH,
>>> +		[NVME_ZONE_RESET]	= REQ_OP_ZONE_RESET,
>>> +	};
>>> +
>>> +	if (zsa > ARRAY_SIZE(zsa_to_op)) {
>>> +		status = NVME_SC_INVALID_FIELD;
>>> +		goto out;
>>> +	}
>>> +
>>> +	op = zsa_to_op[zsa];
>>> +
>>> +	if (req->cmd->zms.select_all) {
>>> +		sect = 0;
>>> +		nr_sects = get_capacity(req->ns->bdev->bd_disk);
>>> +	} else {
>>> +		sect = nvmet_lba_to_sect(req->ns, req->cmd->zms.slba);
>>> +		nr_sects = bdev_zone_sectors(req->ns->bdev);
>>> +	}
>>> +
>>> +	ret = blkdev_zone_mgmt(req->ns->bdev, op, sect, nr_sects, GFP_KERNEL);
>>> +	if (ret)
>>> +		status = NVME_SC_INTERNAL;
>> This one is a little odd with regard to the ALL bit. In the block layer, only
>> zone reset all is supported, which mean that the above will not do
>> open/close/finish all. Only reset all will work. Open/close/finish all need to
>> be emulated here: do a full report zone and based on the zone condition and op,
>> call blkdev_zone_mgmt() for each zone that need a operation. Ideally,
>> blkdev_zone_mgmt() should be called in the report cb, but I am not sure if that
>> cannot create some context problems...
> 
> Please see the explanation at the end [1].
> 
>>> +out:
>>> +	nvmet_req_complete(req, status);
>>> +}
>>> +
>>> +static void nvmet_bdev_zone_append_bio_done(struct bio *bio)
>>> +{
>>> +	struct nvmet_req *req = bio->bi_private;
>>> +
>>> +	req->cqe->result.u64 = nvmet_sect_to_lba(req->ns,
>>> +						 bio->bi_iter.bi_sector);
>> You should do this only if status is success, no ?
> 
> I'll add a BLK_STS_OK check before the assignment.
> 
>>> +	nvmet_req_complete(req, blk_to_nvme_status(req, bio->bi_status));
>>> +	if (bio != &req->b.inline_bio)
>>> +		bio_put(bio);
>>> +}
>>> +
>>> +void nvmet_bdev_execute_zone_append(struct nvmet_req *req)
>>> +{
>>> +	sector_t sect = nvmet_lba_to_sect(req->ns, req->cmd->rw.slba);
>>> +	u16 status = NVME_SC_SUCCESS;
>>> +	unsigned int total_len = 0;
>>> +	struct scatterlist *sg;
>>> +	int ret = 0, sg_cnt;
>>> +	struct bio *bio;
>>> +
>>> +	/* Request is completed on len mismatch in nvmet_check_transter_len() */
>>> +	if (!nvmet_check_transfer_len(req, nvmet_rw_data_len(req)))
>>> +		return;
>>> +
>>> +	if (!req->sg_cnt) {
>>> +		nvmet_req_complete(req, 0);
>> isn't this an error ? (not entirely sure)
> 
> if transfer len matches the rw len and it is zero we cannot send any data
> so just complete the command.

That I understand. But I have not checked if len == 0 is allowed by the
standard. Did you check ? Looking at it now, zone append NLB field is 0 based,
so I do not see how the command can ever have len == 0. That seems to me like an
incorrect command that should be aborted.

> 
>>
>>> +		return;
>>> +	}
>>> +
>>> +	if (req->transfer_len <= NVMET_MAX_INLINE_DATA_LEN) {
>>> +		bio = &req->b.inline_bio;
>>> +		bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
>>>
> 
> [1] Zone Mgmt send emulation with all bit comment :-
> 
> I ran the test where all the zones are set to the EMPTY right after creating
> a controller on the host (initiator), see [A]. With the passthru command
> with
> all bit set, I was able to change the state of all the zones, see [B].
> 
> So I did not understand your comment about how all bit is failing to
> change the
> state of all zones with passthru commnd ?

The behavior of the management commands is different based on the ALL bit being
set or not. E.g., doing a close zone oeartion on all zones of the device with
the ALL bit not set is not equivalent to doing a single close zone operation
with the ALL bit set:
1) With the ALL bit not set:
  a) imp and exp open zones will be transitioned to close
  b) the command will fail for empty, full, read-only and offline zones
2) With the all bit set:
  a) All imp and exp open zones will be transitioned to close
  b) All oher zones will be ignored

1.b and 2.b is the difference. That is why you need filtering and cannot simply
call blkdev_zone_mgmt() over the entire capacity. Doing so will result in (1)
instead of (2). Similar differences exist for open and finish zones. I.e. Finish
all will ignore empty zones whereas a finish for a single zone will act on an
empty zone. Please check the specs to see these differences. They are clearly
stated in section 4.3.

> 
> 
> A. All zones are empty.
> 
> # nvme zns report-zones /dev/nvme1n1
> nr_zones: 32
> SLBA: 0x0     WP: 0x0     Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4000  WP: 0x4000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x8000  WP: 0x8000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0xc000  WP: 0xc000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x10000 WP: 0x10000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x14000 WP: 0x14000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x18000 WP: 0x18000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x1c000 WP: 0x1c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x20000 WP: 0x20000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x24000 WP: 0x24000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x28000 WP: 0x28000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x2c000 WP: 0x2c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x30000 WP: 0x30000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x34000 WP: 0x34000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x38000 WP: 0x38000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x3c000 WP: 0x3c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x40000 WP: 0x40000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x44000 WP: 0x44000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x48000 WP: 0x48000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4c000 WP: 0x4c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x50000 WP: 0x50000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x54000 WP: 0x54000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x58000 WP: 0x58000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x5c000 WP: 0x5c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x60000 WP: 0x60000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x64000 WP: 0x64000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x68000 WP: 0x68000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x6c000 WP: 0x6c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x70000 WP: 0x70000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x74000 WP: 0x74000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x78000 WP: 0x78000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x7c000 WP: 0x7c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> 
> B. Now we send the passthru command with all bit set  for
>     zsa values RESET 0x04, OPEN 0x03, CLOSE 0x01, FINISH 0x02
>     in the same oder as above. All the zones state are changed.
> 
> # for zsa in 4 3 1 2 ; do
>> nvme zns zone-mgmt-send /dev/nvme1n1 -a -zsa=0x${zsa}
>> nvme zns report-zones /dev/nvme1n1
>> done
> 
> + nvme zns zone-mgmt-send /dev/nvme1n1 -a -zsa=0x4
> zone-mgmt-send: Success, action:4 zone:0 all:1 nsid:1
> + nvme zns report-zones /dev/nvme1n1
> nr_zones: 32
> SLBA: 0x0     WP: 0x0     Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4000  WP: 0x4000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x8000  WP: 0x8000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0xc000  WP: 0xc000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x10000 WP: 0x10000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x14000 WP: 0x14000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x18000 WP: 0x18000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x1c000 WP: 0x1c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x20000 WP: 0x20000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x24000 WP: 0x24000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x28000 WP: 0x28000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x2c000 WP: 0x2c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x30000 WP: 0x30000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x34000 WP: 0x34000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x38000 WP: 0x38000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x3c000 WP: 0x3c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x40000 WP: 0x40000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x44000 WP: 0x44000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x48000 WP: 0x48000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4c000 WP: 0x4c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x50000 WP: 0x50000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x54000 WP: 0x54000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x58000 WP: 0x58000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x5c000 WP: 0x5c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x60000 WP: 0x60000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x64000 WP: 0x64000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x68000 WP: 0x68000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x6c000 WP: 0x6c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x70000 WP: 0x70000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x74000 WP: 0x74000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x78000 WP: 0x78000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x7c000 WP: 0x7c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> + for i in 4 3 1 2
> + nvme zns zone-mgmt-send /dev/nvme1n1 -a -zsa=0x3
> zone-mgmt-send: Success, action:3 zone:0 all:1 nsid:1
> + nvme zns report-zones /dev/nvme1n1
> nr_zones: 32
> SLBA: 0x0     WP: 0x0     Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x4000  WP: 0x4000  Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x8000  WP: 0x8000  Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0xc000  WP: 0xc000  Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x10000 WP: 0x10000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x14000 WP: 0x14000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x18000 WP: 0x18000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x1c000 WP: 0x1c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x20000 WP: 0x20000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x24000 WP: 0x24000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x28000 WP: 0x28000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x2c000 WP: 0x2c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x30000 WP: 0x30000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x34000 WP: 0x34000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x38000 WP: 0x38000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x3c000 WP: 0x3c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x40000 WP: 0x40000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x44000 WP: 0x44000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x48000 WP: 0x48000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x4c000 WP: 0x4c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x50000 WP: 0x50000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x54000 WP: 0x54000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x58000 WP: 0x58000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x5c000 WP: 0x5c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x60000 WP: 0x60000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x64000 WP: 0x64000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x68000 WP: 0x68000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x6c000 WP: 0x6c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x70000 WP: 0x70000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x74000 WP: 0x74000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x78000 WP: 0x78000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> SLBA: 0x7c000 WP: 0x7c000 Cap: 0x4000 State: EXP_OPENED Type:
> SEQWRITE_REQ Attrs: 0x0
> + for i in 4 3 1 2
> + nvme zns zone-mgmt-send /dev/nvme1n1 -a -zsa=0x1
> zone-mgmt-send: Success, action:1 zone:0 all:1 nsid:1
> + nvme zns report-zones /dev/nvme1n1
> nr_zones: 32
> SLBA: 0x0     WP: 0x0     Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4000  WP: 0x4000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x8000  WP: 0x8000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0xc000  WP: 0xc000  Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x10000 WP: 0x10000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x14000 WP: 0x14000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x18000 WP: 0x18000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x1c000 WP: 0x1c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x20000 WP: 0x20000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x24000 WP: 0x24000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x28000 WP: 0x28000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x2c000 WP: 0x2c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x30000 WP: 0x30000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x34000 WP: 0x34000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x38000 WP: 0x38000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x3c000 WP: 0x3c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x40000 WP: 0x40000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x44000 WP: 0x44000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x48000 WP: 0x48000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4c000 WP: 0x4c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x50000 WP: 0x50000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x54000 WP: 0x54000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x58000 WP: 0x58000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x5c000 WP: 0x5c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x60000 WP: 0x60000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x64000 WP: 0x64000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x68000 WP: 0x68000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x6c000 WP: 0x6c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x70000 WP: 0x70000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x74000 WP: 0x74000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x78000 WP: 0x78000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x7c000 WP: 0x7c000 Cap: 0x4000 State: EMPTY Type: SEQWRITE_REQ
> Attrs: 0x0
> + for i in 4 3 1 2
> + nvme zns zone-mgmt-send /dev/nvme1n1 -a -zsa=0x2
> zone-mgmt-send: Success, action:2 zone:0 all:1 nsid:1
> + nvme zns report-zones /dev/nvme1n1
> nr_zones: 32
> SLBA: 0x0     WP: 0x4000  Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0               

This is incorrect. Finish all ignores empty zones.

> SLBA: 0x4000  WP: 0x8000  Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x8000  WP: 0xc000  Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0xc000  WP: 0x10000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x10000 WP: 0x14000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x14000 WP: 0x18000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x18000 WP: 0x1c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x1c000 WP: 0x20000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x20000 WP: 0x24000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x24000 WP: 0x28000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x28000 WP: 0x2c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x2c000 WP: 0x30000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x30000 WP: 0x34000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x34000 WP: 0x38000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x38000 WP: 0x3c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x3c000 WP: 0x40000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x40000 WP: 0x44000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x44000 WP: 0x48000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x48000 WP: 0x4c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x4c000 WP: 0x50000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x50000 WP: 0x54000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x54000 WP: 0x58000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x58000 WP: 0x5c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x5c000 WP: 0x60000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x60000 WP: 0x64000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x64000 WP: 0x68000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x68000 WP: 0x6c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x6c000 WP: 0x70000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x70000 WP: 0x74000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x74000 WP: 0x78000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x78000 WP: 0x7c000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> SLBA: 0x7c000 WP: 0x80000 Cap: 0x4000 State: FULL Type: SEQWRITE_REQ
> Attrs: 0x0
> + set +x
> 
> 
> 


-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list