Commit 3fc79359 authored by Tsuyoshi Uchida's avatar Tsuyoshi Uchida Committed by Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent c7e1ab79
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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);
	}
}