Patch "nvme: don't check nvme_req flags for new req" has been added to the 5.10-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    nvme: don't check nvme_req flags for new req

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvme-don-t-check-nvme_req-flags-for-new-req.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1372f94d4eda930a943bbcb4303e05479ba1301d
Author: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
Date:   Sun Feb 28 18:06:08 2021 -0800

    nvme: don't check nvme_req flags for new req
    
    [ Upstream commit c03fd85de293a4f65fcb94a795bf4c12a432bb6c ]
    
    nvme_clear_request() has a check for flag REQ_DONTPREP and it is called
    from nvme_init_request() and nvme_setuo_cmd().
    
    The function nvme_init_request() is called from nvme_alloc_request()
    and nvme_alloc_request_qid(). From these two callers new request is
    allocated everytime. For newly allocated request RQF_DONTPREP is never
    set. Since after getting a tag, block layer sets the req->rq_flags == 0
    and never sets the REQ_DONTPREP when returning the request :-
    
    nvme_alloc_request()
            blk_mq_alloc_request()
                    blk_mq_rq_ctx_init()
                            rq->rq_flags = 0 <----
    
    nvme_alloc_request_qid()
            blk_mq_alloc_request_hctx()
                    blk_mq_rq_ctx_init()
                            rq->rq_flags = 0 <----
    
    The block layer does set req->rq_flags but REQ_DONTPREP is not one of
    them and that is set by the driver.
    
    That means we can unconditinally set the REQ_DONTPREP value to the
    rq->rq_flags when nvme_init_request()->nvme_clear_request() is called
    from above two callers.
    
    Move the check for REQ_DONTPREP from nvme_clear_nvme_request() into
    nvme_setup_cmd().
    
    This is needed since nvme_alloc_request() now gets called from fast
    path when NVMeOF target is configured with passthru backend to avoid
    unnecessary checks in the fast path.
    
    Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d81b0cff15e0..c42ad0b8247b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -531,11 +531,9 @@ EXPORT_SYMBOL_NS_GPL(nvme_put_ns, NVME_TARGET_PASSTHRU);
 
 static inline void nvme_clear_nvme_request(struct request *req)
 {
-	if (!(req->rq_flags & RQF_DONTPREP)) {
-		nvme_req(req)->retries = 0;
-		nvme_req(req)->flags = 0;
-		req->rq_flags |= RQF_DONTPREP;
-	}
+	nvme_req(req)->retries = 0;
+	nvme_req(req)->flags = 0;
+	req->rq_flags |= RQF_DONTPREP;
 }
 
 static inline unsigned int nvme_req_op(struct nvme_command *cmd)
@@ -854,7 +852,8 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
 	struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
 	blk_status_t ret = BLK_STS_OK;
 
-	nvme_clear_nvme_request(req);
+	if (!(req->rq_flags & RQF_DONTPREP))
+		nvme_clear_nvme_request(req);
 
 	memset(cmd, 0, sizeof(*cmd));
 	switch (req_op(req)) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux