Re: [PATCH v3 8/8] nvme: Enable pipelining of zoned writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/27/22 20:16, Keith Busch wrote:
On Mon, Jun 27, 2022 at 04:43:35PM -0700, Bart Van Assche wrote:
@@ -854,6 +854,12 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
  	if (req->cmd_flags & REQ_RAHEAD)
  		dsmgmt |= NVME_RW_DSM_FREQ_PREFETCH;
+ if (blk_queue_pipeline_zoned_writes(req->q) &&
+	    blk_rq_is_seq_zone_write(req))
+		nvme_req(req)->max_retries =
+			min(0UL + type_max(typeof(nvme_req(req)->max_retries)),
+			    nvme_req(req)->max_retries + req->q->nr_requests);

I can't make much sense of what the above is trying to accomplish. This
reevaluates max_retries every time the request is retried, and the new
max_retries is based on the previous max_retries?

Hi Keith,

Thanks for your question. It made me realize that the above code should be
moved. How about replacing patch 8/8 with the (untested) patch below?

Thanks,

Bart.


Subject: [PATCH] nvme: Enable pipelining of zoned writes

Enabling pipelining for zoned writes. Increase the number of retries
for zoned writes to the maximum number of outstanding commands per hardware
queue.


diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index aeeaca1c3197..6a0b824a343f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -630,10 +630,15 @@ EXPORT_SYMBOL_NS_GPL(nvme_put_ns, NVME_TARGET_PASSTHRU);

 static inline void nvme_clear_nvme_request(struct request *req)
 {
+	u32 max_retries = nvme_max_retries;
+
 	nvme_req(req)->status = 0;
 	nvme_req(req)->retries = 0;
 	nvme_req(req)->flags = 0;
-	nvme_req(req)->max_retries = nvme_max_retries;
+	if (blk_queue_pipeline_zoned_writes(req->q) &&
+	    blk_rq_is_seq_zone_write(req))
+		max_retries += req->q->nr_requests;
+	nvme_req(req)->max_retries = min(0xffU, max_retries);
 	req->rq_flags |= RQF_DONTPREP;
 }

diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
index 9f81beb4df4e..0b10db3b8d3a 100644
--- a/drivers/nvme/host/zns.c
+++ b/drivers/nvme/host/zns.c
@@ -54,6 +54,8 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
 	struct nvme_id_ns_zns *id;
 	int status;

+	blk_queue_flag_set(QUEUE_FLAG_PIPELINE_ZONED_WRITES, ns->queue);
+
 	/* Driver requires zone append support */
 	if ((le32_to_cpu(log->iocs[nvme_cmd_zone_append]) &
 			NVME_CMD_EFFECTS_CSUPP)) {



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux