nvme: add assert in nvme_ns_cmd_zone_append_with_md()
Zone append commands cannot be split. _nvme_ns_cmd_rw() should never cause a NVME_PAYLOAD_TYPE_CONTIG zone append request to be split. This is currently true, but add an assert to make sure that any refactoring to _nvme_ns_cmd_rw() does not break this promise. Also add error handling, since release builds are built with asserts disabled. Follow-up patches will refactor _nvme_ns_cmd_rw(). Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> Change-Id: I5fd2440c4c9d6bd8d56f30354b208a9047b64729 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6246 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
c56fb6d3ee
commit
b05b3d0a12
@ -784,6 +784,18 @@ nvme_ns_cmd_zone_append_with_md(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair
|
||||
SPDK_NVME_OPC_ZONE_APPEND,
|
||||
io_flags, apptag_mask, apptag, false);
|
||||
if (req != NULL) {
|
||||
/*
|
||||
* Zone append commands cannot be split (num_children has to be 0).
|
||||
* For NVME_PAYLOAD_TYPE_CONTIG, _nvme_ns_cmd_rw() should never cause a split
|
||||
* to happen, since a too large request would have already been failed by
|
||||
* nvme_ns_cmd_check_zone_append(), since zasl <= mdts.
|
||||
*/
|
||||
assert(req->num_children == 0);
|
||||
if (req->num_children) {
|
||||
nvme_request_free_children(req);
|
||||
nvme_free_request(req);
|
||||
return -EINVAL;
|
||||
}
|
||||
return nvme_qpair_submit_request(qpair, req);
|
||||
} else if (nvme_ns_check_request_length(lba_count,
|
||||
ns->sectors_per_max_io,
|
||||
|
Loading…
Reference in New Issue
Block a user