nvme: rename remove_child_request for consistency

Rename nvme_remove_child_request() to nvme_request_remove_child() and
move it next to nvme_request_add_child() to make the symmetry clear.

Change-Id: I78747c44ab3db1a656b33555a45f634dc5a55b31
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-04-08 09:55:27 -07:00
parent 1f19be6515
commit 2cf675bb29
6 changed files with 20 additions and 21 deletions

View File

@ -146,14 +146,6 @@ nvme_allocate_request_null(spdk_nvme_cmd_cb cb_fn, void *cb_arg)
return nvme_allocate_request_contig(NULL, 0, cb_fn, cb_arg);
}
void
nvme_remove_child_request(struct nvme_request *parent,
struct nvme_request *child)
{
parent->num_children--;
TAILQ_REMOVE(&parent->children, child, child_tailq);
}
void
nvme_free_request(struct nvme_request *req)
{

View File

@ -549,7 +549,7 @@ struct nvme_request *nvme_allocate_request_null(spdk_nvme_cmd_cb cb_fn, void *cb
struct nvme_request *nvme_allocate_request_contig(void *buffer, uint32_t payload_size,
spdk_nvme_cmd_cb cb_fn, void *cb_arg);
void nvme_free_request(struct nvme_request *req);
void nvme_remove_child_request(struct nvme_request *parent, struct nvme_request *child);
void nvme_request_remove_child(struct nvme_request *parent, struct nvme_request *child);
bool nvme_intel_has_quirk(struct pci_id *id, uint64_t quirk);
void spdk_nvme_ctrlr_opts_set_defaults(struct spdk_nvme_ctrlr_opts *opts);

View File

@ -44,7 +44,7 @@ nvme_cb_complete_child(void *child_arg, const struct spdk_nvme_cpl *cpl)
struct nvme_request *child = child_arg;
struct nvme_request *parent = child->parent;
nvme_remove_child_request(parent, child);
nvme_request_remove_child(parent, child);
if (spdk_nvme_cpl_is_error(cpl)) {
memcpy(&parent->parent_status, cpl, sizeof(*cpl));
@ -80,6 +80,13 @@ nvme_request_add_child(struct nvme_request *parent, struct nvme_request *child)
child->cb_arg = child;
}
void
nvme_request_remove_child(struct nvme_request *parent, struct nvme_request *child)
{
parent->num_children--;
TAILQ_REMOVE(&parent->children, child, child_tailq);
}
static struct nvme_request *
_nvme_ns_cmd_split_request(struct spdk_nvme_ns *ns,
const struct nvme_payload *payload,
@ -104,7 +111,7 @@ _nvme_ns_cmd_split_request(struct spdk_nvme_ns *ns,
/* free all child nvme_request */
TAILQ_FOREACH_SAFE(child, &req->children,
child_tailq, tmp) {
nvme_remove_child_request(req, child);
nvme_request_remove_child(req, child);
nvme_free_request(child);
}
}

View File

@ -837,7 +837,7 @@ nvme_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_request *re
if (rc != 0)
child_req_failed = true;
} else { /* free remaining child_reqs since one child_req fails */
nvme_remove_child_request(req, child_req);
nvme_request_remove_child(req, child_req);
nvme_free_request(child_req);
}
}

View File

@ -191,7 +191,7 @@ split_test2(void)
CU_ASSERT(g_request->num_children == 2);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 128 * 1024);
@ -200,7 +200,7 @@ split_test2(void)
nvme_free_request(child);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 128 * 1024);
@ -247,7 +247,7 @@ split_test3(void)
SPDK_CU_ASSERT_FATAL(g_request->num_children == 2);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 128 * 1024);
@ -256,7 +256,7 @@ split_test3(void)
nvme_free_request(child);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 128 * 1024);
@ -306,7 +306,7 @@ split_test4(void)
SPDK_CU_ASSERT_FATAL(g_request->num_children == 3);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == (256 - 10) * 512);
@ -318,7 +318,7 @@ split_test4(void)
nvme_free_request(child);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 128 * 1024);
@ -330,7 +330,7 @@ split_test4(void)
nvme_free_request(child);
child = TAILQ_FIRST(&g_request->children);
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
nvme_cmd_interpret_rw(&child->cmd, &cmd_lba, &cmd_lba_count);
CU_ASSERT(child->num_children == 0);
CU_ASSERT(child->payload_size == 10 * 512);
@ -384,7 +384,7 @@ test_cmd_child_request(void)
CU_ASSERT(g_request->num_children == 4);
TAILQ_FOREACH_SAFE(child, &g_request->children, child_tailq, tmp) {
nvme_remove_child_request(g_request, child);
nvme_request_remove_child(g_request, child);
CU_ASSERT(child->payload_offset == offset);
CU_ASSERT(child->cmd.opc == SPDK_NVME_OPC_READ);
CU_ASSERT(child->cmd.nsid == ns.id);

View File

@ -177,7 +177,7 @@ nvme_free_request(struct nvme_request *req)
}
void
nvme_remove_child_request(struct nvme_request *parent,
nvme_request_remove_child(struct nvme_request *parent,
struct nvme_request *child)
{
parent->num_children--;