nvmf: store registrants' host id into subsystem's poll group
Now data structure spdk_nvmf_subsystem_pg_ns_info holds all the reservation information from the associate namespace, so for the IO processing routine we don't need to send a message to the subsystem's thread to check the IO command is permited or not. Change-Id: Ib6be6abf7bf5f24c230dff80c163a1eb963e20d0 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448256 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
1fd5b1da33
commit
ba431e231e
@ -865,8 +865,9 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
|
||||
{
|
||||
struct spdk_nvmf_subsystem_poll_group *sgroup;
|
||||
uint32_t new_num_ns, old_num_ns;
|
||||
uint32_t i;
|
||||
uint32_t i, j;
|
||||
struct spdk_nvmf_ns *ns;
|
||||
struct spdk_nvmf_registrant *reg, *tmp;
|
||||
|
||||
/* Make sure our poll group has memory for this subsystem allocated */
|
||||
if (subsystem->id >= group->num_sgroups) {
|
||||
@ -953,7 +954,17 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
|
||||
} else if (ns->rtype && ns->holder) {
|
||||
sgroup->ns_info[i].crkey = ns->crkey;
|
||||
sgroup->ns_info[i].rtype = ns->rtype;
|
||||
sgroup->ns_info[i].hostid = ns->holder->hostid;
|
||||
sgroup->ns_info[i].holder_id = ns->holder->hostid;
|
||||
|
||||
memset(&sgroup->ns_info[i].reg_hostid, 0, SPDK_NVMF_MAX_NUM_REGISTRANTS * sizeof(struct spdk_uuid));
|
||||
j = 0;
|
||||
TAILQ_FOREACH_SAFE(reg, &ns->registrants, link, tmp) {
|
||||
if (j >= SPDK_NVMF_MAX_NUM_REGISTRANTS) {
|
||||
SPDK_ERRLOG("Maximum %u registrants can support.\n", SPDK_NVMF_MAX_NUM_REGISTRANTS);
|
||||
return -EINVAL;
|
||||
}
|
||||
sgroup->ns_info[i].reg_hostid[j++] = reg->hostid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,6 +112,9 @@ struct spdk_nvmf_transport_poll_group {
|
||||
TAILQ_ENTRY(spdk_nvmf_transport_poll_group) link;
|
||||
};
|
||||
|
||||
/* Maximum number of registrants supported per namespace */
|
||||
#define SPDK_NVMF_MAX_NUM_REGISTRANTS 16
|
||||
|
||||
struct spdk_nvmf_subsystem_pg_ns_info {
|
||||
struct spdk_io_channel *channel;
|
||||
/* current reservation key, no reservation if the value is 0 */
|
||||
@ -119,7 +122,9 @@ struct spdk_nvmf_subsystem_pg_ns_info {
|
||||
/* reservation type */
|
||||
enum spdk_nvme_reservation_type rtype;
|
||||
/* Host ID which holds the reservation */
|
||||
struct spdk_uuid hostid;
|
||||
struct spdk_uuid holder_id;
|
||||
/* Host ID for the registrants with the namespace */
|
||||
struct spdk_uuid reg_hostid[SPDK_NVMF_MAX_NUM_REGISTRANTS];
|
||||
};
|
||||
|
||||
struct spdk_nvmf_subsystem_poll_group {
|
||||
|
Loading…
Reference in New Issue
Block a user