diff options
author | Kanchan Joshi <joshi.k@samsung.com> | 2021-04-27 12:17:47 +0530 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-05-04 09:35:49 +0200 |
commit | 51ad06cd698cb9ff280a769ed8d57210a1d2266d (patch) | |
tree | e0473e5abf54d0703ed08fa09aa7fd9d05d44494 /drivers/nvme | |
parent | 4c74d1f80381996027bacc4f6c554948ef9bf374 (diff) | |
download | linux-51ad06cd698cb9ff280a769ed8d57210a1d2266d.tar.bz2 |
nvme: avoid memset for passthrough requests
nvme_clear_nvme_request() clears the nvme_command, which is unncessary
for passthrough requests as nvme_command is overwritten immediately.
Move clearing part from this helper to the caller, so that double memset
for passthrough requests is avoided.
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f2d1f2d699b8..61e122cecc2a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -589,9 +589,6 @@ EXPORT_SYMBOL_NS_GPL(nvme_put_ns, NVME_TARGET_PASSTHRU); static inline void nvme_clear_nvme_request(struct request *req) { - struct nvme_command *cmd = nvme_req(req)->cmd; - - memset(cmd, 0, sizeof(*cmd)); nvme_req(req)->retries = 0; nvme_req(req)->flags = 0; req->rq_flags |= RQF_DONTPREP; @@ -903,8 +900,10 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req) struct nvme_command *cmd = nvme_req(req)->cmd; blk_status_t ret = BLK_STS_OK; - if (!(req->rq_flags & RQF_DONTPREP)) + if (!(req->rq_flags & RQF_DONTPREP)) { nvme_clear_nvme_request(req); + memset(cmd, 0, sizeof(*cmd)); + } switch (req_op(req)) { case REQ_OP_DRV_IN: |