[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 05/11] hw/block/nvme: Support Zoned Namespace Command Set
From: |
Klaus Jensen |
Subject: |
Re: [PATCH v7 05/11] hw/block/nvme: Support Zoned Namespace Command Set |
Date: |
Mon, 19 Oct 2020 17:55:37 +0200 |
On Oct 19 11:50, Klaus Jensen wrote:
> On Oct 19 11:17, Dmitry Fomichev wrote:
> > +static bool nvme_finalize_zoned_write(NvmeNamespace *ns, NvmeRequest *req,
> > + bool failed)
> > +{
> > + NvmeRwCmd *rw = (NvmeRwCmd *)&req->cmd;
> > + NvmeZone *zone;
> > + uint64_t slba, start_wp = req->cqe.result64;
> > + uint32_t nlb;
> > +
> > + if (rw->opcode != NVME_CMD_WRITE &&
> > + rw->opcode != NVME_CMD_ZONE_APPEND &&
> > + rw->opcode != NVME_CMD_WRITE_ZEROES) {
> > + return false;
> > + }
> > +
> > + slba = le64_to_cpu(rw->slba);
> > + nlb = le16_to_cpu(rw->nlb) + 1;
> > + zone = nvme_get_zone_by_slba(ns, slba);
> > +
> > + if (!failed && zone->w_ptr < start_wp + nlb) {
> > + /*
> > + * A preceding queued write to the zone has failed,
> > + * now this write is not at the WP, fail it too.
> > + */
> > + failed = true;
> > + }
> > +
> > + if (failed) {
> > + if (zone->w_ptr > start_wp) {
> > + zone->w_ptr = start_wp;
> > + zone->d.wp = start_wp;
> > + }
>
> This doesn't fix the data corruption. The example from my last review
> still applies.
>
An easy fix is to just unconditionally advance the write pointer in all
cases.
signature.asc
Description: PGP signature
- [PATCH v7 03/11] hw/block/nvme: Add support for Namespace Types, (continued)
- [PATCH v7 03/11] hw/block/nvme: Add support for Namespace Types, Dmitry Fomichev, 2020/10/18
- [PATCH v7 04/11] hw/block/nvme: Support allocated CNS command variants, Dmitry Fomichev, 2020/10/18
- [PATCH v7 05/11] hw/block/nvme: Support Zoned Namespace Command Set, Dmitry Fomichev, 2020/10/18
- [PATCH v7 07/11] hw/block/nvme: Support Zone Descriptor Extensions, Dmitry Fomichev, 2020/10/18
- [PATCH v7 08/11] hw/block/nvme: Add injection of Offline/Read-Only zones, Dmitry Fomichev, 2020/10/18
- [PATCH v7 06/11] hw/block/nvme: Introduce max active and open zone limits, Dmitry Fomichev, 2020/10/18
- [PATCH v7 09/11] hw/block/nvme: Document zoned parameters in usage text, Dmitry Fomichev, 2020/10/18