nvmf: generate reservation notice log on controller's thread

All the reservation commands are processed on subsystem's thread,
however the reservation notice log are controller related, and
the get log page command with reservation page will be processed
on controller's thread, so we use the same thread for generating
the log.

Change-Id: Ie000320d74242b979f6638d703523f063347ec29
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449852
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2019-04-02 01:06:51 -04:00 committed by Jim Harris
parent c596ea4bd5
commit 6025375024
2 changed files with 26 additions and 13 deletions

View File

@ -2087,6 +2087,28 @@ spdk_nvmf_ctrlr_abort_aer(struct spdk_nvmf_ctrlr *ctrlr)
ctrlr->aer_req = NULL;
}
static void
_nvmf_ctrlr_add_reservation_log(void *ctx)
{
struct spdk_nvmf_reservation_log *log = (struct spdk_nvmf_reservation_log *)ctx;
struct spdk_nvmf_ctrlr *ctrlr = log->ctrlr;
ctrlr->log_page_count++;
/* Maximum number of queued log pages is 255 */
if (ctrlr->num_avail_log_pages == 0xff) {
struct spdk_nvmf_reservation_log *entry;
entry = TAILQ_LAST(&ctrlr->log_head, log_page_head);
entry->log.log_page_count = ctrlr->log_page_count;
free(log);
return;
}
log->log.log_page_count = ctrlr->log_page_count;
log->log.num_avail_log_pages = ctrlr->num_avail_log_pages++;
TAILQ_INSERT_TAIL(&ctrlr->log_head, log, link);
}
void
spdk_nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr,
struct spdk_nvmf_ns *ns,
@ -2116,26 +2138,16 @@ spdk_nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr,
return;
}
ctrlr->log_page_count++;
/* Maximum number of queued log pages is 255 */
if (ctrlr->num_avail_log_pages == 0xff) {
log = TAILQ_LAST(&ctrlr->log_head, log_page_head);
log->log.log_page_count = ctrlr->log_page_count;
return;
}
log = calloc(1, sizeof(*log));
if (!log) {
SPDK_ERRLOG("Alloc log page failed, ignore the log\n");
return;
}
log->log.log_page_count = ctrlr->log_page_count;
log->ctrlr = ctrlr;
log->log.type = type;
log->log.num_avail_log_pages = ctrlr->num_avail_log_pages++;
log->log.nsid = ns->nsid;
TAILQ_INSERT_TAIL(&ctrlr->log_head, log, link);
spdk_thread_send_msg(ctrlr->thread, _nvmf_ctrlr_add_reservation_log, log);
}
/* Check from subsystem poll group's namespace information data structure */

View File

@ -247,6 +247,7 @@ struct spdk_nvmf_ctrlr_feat {
struct spdk_nvmf_reservation_log {
struct spdk_nvme_reservation_notification_log log;
TAILQ_ENTRY(spdk_nvmf_reservation_log) link;
struct spdk_nvmf_ctrlr *ctrlr;
};
/*