nvme: fix _nvme_ns_cmd_split_sgl_request for last SGE not page aligned
Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I2b6a22591d0a5f7435d9fd9dd8d6a1c854da3d89 Reviewed-on: https://review.gerrithub.io/371978 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
This commit is contained in:
parent
bab34df6ca
commit
0b33e77e4c
@ -271,6 +271,12 @@ _nvme_ns_cmd_split_sgl_request(struct spdk_nvme_ns *ns,
|
|||||||
if (req_current_length < req->payload_size) {
|
if (req_current_length < req->payload_size) {
|
||||||
args->next_sge_fn(args->cb_arg, (void **)&address, &sge_length);
|
args->next_sge_fn(args->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.
|
||||||
|
*/
|
||||||
|
start_valid = _is_page_aligned(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (start_valid && end_valid && !last_sge) {
|
if (start_valid && end_valid && !last_sge) {
|
||||||
|
@ -288,6 +288,23 @@ static void build_io_request_10(struct io_request *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void build_io_request_11(struct io_request *req)
|
||||||
|
{
|
||||||
|
/* This test case focuses on the last element not starting on a page boundary. */
|
||||||
|
const size_t req_len[] = { 512, 512 };
|
||||||
|
const size_t req_off[] = { 0xe00, 0x800 };
|
||||||
|
struct sgl_element *iovs = req->iovs;
|
||||||
|
uint32_t i;
|
||||||
|
req->nseg = SPDK_COUNTOF(req_len);
|
||||||
|
assert(SPDK_COUNTOF(req_len) == SPDK_COUNTOF(req_off));
|
||||||
|
|
||||||
|
for (i = 0; i < req->nseg; i++) {
|
||||||
|
iovs[i].base = spdk_dma_zmalloc(req_off[i] + req_len[i], 0x4000, NULL);
|
||||||
|
iovs[i].offset = req_off[i];
|
||||||
|
iovs[i].len = req_len[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef void (*nvme_build_io_req_fn_t)(struct io_request *req);
|
typedef void (*nvme_build_io_req_fn_t)(struct io_request *req);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -498,7 +515,8 @@ int main(int argc, char **argv)
|
|||||||
|| TEST(build_io_request_7)
|
|| TEST(build_io_request_7)
|
||||||
|| TEST(build_io_request_8)
|
|| TEST(build_io_request_8)
|
||||||
|| TEST(build_io_request_9)
|
|| TEST(build_io_request_9)
|
||||||
|| TEST(build_io_request_10)) {
|
|| TEST(build_io_request_10)
|
||||||
|
|| TEST(build_io_request_11)) {
|
||||||
#undef TEST
|
#undef TEST
|
||||||
rc = 1;
|
rc = 1;
|
||||||
printf("%s: failed sgl tests\n", iter->name);
|
printf("%s: failed sgl tests\n", iter->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user