aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2021-01-19 23:01:02 +0100
committerKlaus Jensen <k.jensen@samsung.com>2021-03-09 11:00:57 +0100
commitb0a79429d964ad2d8c1c41fdc18b3ae5def41ff8 (patch)
tree89f0d70ec3999263b0fd1d820dd34b78e6ee8d41 /hw
parent975b64665048e8e283a3c9cad9808da0a014e283 (diff)
downloadqemu-b0a79429d964ad2d8c1c41fdc18b3ae5def41ff8.zip
qemu-b0a79429d964ad2d8c1c41fdc18b3ae5def41ff8.tar.gz
qemu-b0a79429d964ad2d8c1c41fdc18b3ae5def41ff8.tar.bz2
hw/block/nvme: pull write pointer advancement to separate function
In preparation for Simple Copy, pull write pointer advancement into a separate function that is independent off an NvmeRequest. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/nvme.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 7897390..44129f8 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1407,6 +1407,16 @@ static inline uint16_t nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone)
return __nvme_zrm_open(ns, zone, false);
}
+static void __nvme_advance_zone_wp(NvmeNamespace *ns, NvmeZone *zone,
+ uint32_t nlb)
+{
+ zone->d.wp += nlb;
+
+ if (zone->d.wp == nvme_zone_wr_boundary(zone)) {
+ nvme_zrm_finish(ns, zone);
+ }
+}
+
static void nvme_finalize_zoned_write(NvmeNamespace *ns, NvmeRequest *req)
{
NvmeRwCmd *rw = (NvmeRwCmd *)&req->cmd;
@@ -1418,11 +1428,7 @@ static void nvme_finalize_zoned_write(NvmeNamespace *ns, NvmeRequest *req)
nlb = le16_to_cpu(rw->nlb) + 1;
zone = nvme_get_zone_by_slba(ns, slba);
- zone->d.wp += nlb;
-
- if (zone->d.wp == nvme_zone_wr_boundary(zone)) {
- nvme_zrm_finish(ns, zone);
- }
+ __nvme_advance_zone_wp(ns, zone, nlb);
}
static inline bool nvme_is_write(NvmeRequest *req)