[PATCH V13 2/4] nvmet: add ZBD over ZNS backend support
Chaitanya Kulkarni
Chaitanya.Kulkarni at wdc.com
Thu Apr 8 22:14:24 BST 2021
On 4/8/21 00:24, Christoph Hellwig wrote:
>> +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,
>> + };
>> +
>> + 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;
>> +
>> +record_zone:
> While not bad per se I ind the structure a little odd. I'd move the
> checks into a level of indentation instead.
>
Can you please elaborate on this ?
More information about the Linux-nvme
mailing list