Skip to content

Commit 51ad06c

Browse files
Kanchan JoshiChristoph Hellwig
authored andcommitted
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>
1 parent 4c74d1f commit 51ad06c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,6 @@ EXPORT_SYMBOL_NS_GPL(nvme_put_ns, NVME_TARGET_PASSTHRU);
589589

590590
static inline void nvme_clear_nvme_request(struct request *req)
591591
{
592-
struct nvme_command *cmd = nvme_req(req)->cmd;
593-
594-
memset(cmd, 0, sizeof(*cmd));
595592
nvme_req(req)->retries = 0;
596593
nvme_req(req)->flags = 0;
597594
req->rq_flags |= RQF_DONTPREP;
@@ -903,8 +900,10 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req)
903900
struct nvme_command *cmd = nvme_req(req)->cmd;
904901
blk_status_t ret = BLK_STS_OK;
905902

906-
if (!(req->rq_flags & RQF_DONTPREP))
903+
if (!(req->rq_flags & RQF_DONTPREP)) {
907904
nvme_clear_nvme_request(req);
905+
memset(cmd, 0, sizeof(*cmd));
906+
}
908907

909908
switch (req_op(req)) {
910909
case REQ_OP_DRV_IN:

0 commit comments

Comments
 (0)