nvme: only reassign start_valid if we fetched a new SGE

For a SGL using PRPs, there is always an alignment check of the start
address in the beginning of the loop. This is stored in start_valid.

If the start is indeed valid, we might fetch a new SGE,
and then perform a second alignment check on this new SGE.

However, this second alignment check is done unconditionally,
meaning that for the last SGE in a request, we check if the
same start address is aligned twice.

Only perform the second alignment check if we actually fetched
a new SGE.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I9df8038c650b0879f838d1d9d895e8dd7172840d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6493
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Niklas Cassel 2021-02-19 14:14:51 +00:00 committed by Tomasz Zawadzki
parent dfd7604687
commit 1f49ee235f

View File

@ -253,14 +253,14 @@ _nvme_ns_cmd_split_request_prp(struct spdk_nvme_ns *ns,
req_current_length += sge_length;
if (req_current_length < req->payload_size) {
next_sge_fn(sgl_cb_arg, (void **)&address, &sge_length);
}
/*
* If the next SGE is not page aligned, we will need to create a child
* request for what we have so far, and then start a new child request for
* the next SGE.
* If the next SGE is not page aligned, we will need to create a
* child request for what we have so far, and then start a new
* child request for the next SGE.
*/
start_valid = _is_page_aligned(address, page_size);
}
}
if (start_valid && end_valid && !last_sge) {
continue;