Commit 1f49ee23 authored by Niklas Cassel's avatar Niklas Cassel Committed by Tomasz Zawadzki
Browse files

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: default avatarNiklas 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent dfd76046
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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;