hw/block/nvme: refactor the logic for zone write checks
commit3e22762edc74be3e1ecafc361351a9640d114978
authorKlaus Jensen <k.jensen@samsung.com>
Tue, 19 Jan 2021 13:21:50 +0000 (19 14:21 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Mon, 8 Feb 2021 20:15:54 +0000 (8 21:15 +0100)
tree6adfdce8fc97e551f4e7bf5c3e1f4bbdf28e7845
parenta679dc3efd580de67f30dcb8cb1a52a4bb559899
hw/block/nvme: refactor the logic for zone write checks

Refactor the zone write check logic such that the most "meaningful"
error is returned first. That is, first, if the zone is not writable,
return an appropriate status code for that. Then, make sure we are
actually writing at the write pointer and finally check that we do not
cross the zone write boundary. This aligns with the "priority" of status
codes for zone read checks.

Also add a couple of additional descriptive trace events and remove an
always true assert.

Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Tested-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/block/nvme.c
hw/block/trace-events