nvme/perf: Improve aio code

Use O_WRONLY flag for write IO
Cleanup io_context_t and io_event when perf exits

Change-Id: Iefa1d8be5e017a1ca5719489c1ec4b868df94722
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Tsuyoshi Uchida 2016-05-23 09:24:05 -07:00 committed by Daniel Verkamp
parent c7e1ab79e4
commit 3fc793591d

View File

@ -294,6 +294,8 @@ register_aio_file(const char *path)
if (g_rw_percentage == 100) {
flags = O_RDONLY;
} else if (g_rw_percentage == 0) {
flags = O_WRONLY;
} else {
flags = O_RDWR;
}
@ -549,7 +551,12 @@ init_ns_worker_ctx(struct ns_worker_ctx *ns_ctx)
static void
cleanup_ns_worker_ctx(struct ns_worker_ctx *ns_ctx)
{
if (ns_ctx->entry->type == ENTRY_TYPE_NVME_NS) {
if (ns_ctx->entry->type == ENTRY_TYPE_AIO_FILE) {
#ifdef HAVE_LIBAIO
io_destroy(ns_ctx->u.aio.ctx);
free(ns_ctx->u.aio.events);
#endif
} else {
spdk_nvme_ctrlr_free_io_qpair(ns_ctx->u.nvme.qpair);
}
}