RE: [PATCH 1/3] engines/xnvme: add xnvme engine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Ankit Kumar [mailto:ankit.kumar@xxxxxxxxxxx]
> Sent: Thursday, May 5, 2022 9:20 AM
> To: axboe@xxxxxxxxx
> Cc: fio@xxxxxxxxxxxxxxx; krish.reddy@xxxxxxxxxxx;
> simon.lund@xxxxxxxxxxx; Ankit Kumar <ankit.kumar@xxxxxxxxxxx>
> Subject: [PATCH 1/3] engines/xnvme: add xnvme engine
> 
> This patch introduces a new fio engine to work with xNVMe >= 0.2.0.
> xNVMe provides a user space library (libxnvme) to work with NVMe
> devices. The NVMe driver being used by libxnvme is re-targetable and
> can be any one of the GNU/Linux Kernel NVMe driver via libaio,
> IOCTLs, io_uring, the SPDK NVMe driver, or your own custom NVMe
> driver.
> 
> For more info visit
> https://urldefense.com/v3/__https://protect2.fireeye.com/v1/url?k=ad
> 739a68-ccf88f52-ad721127-74fe4860008a-
> e490d5c8a92d072c&q=1&e=07140046-8b99-485a-a6cf-
> 0c1685707a67&u=https*3A*2F*2Fxnvme.io*2F__;JSUlJQ!!EwVzqGoTKB
> qv-
> 0DWAJBm!ChkUAg8V4FGdLAgw54MUDD8PRpVmo1RBeReZpfMKxWz8a
> DMsUtG1GYPPc9rhJot4-Vw9$
> https://urldefense.com/v3/__https://protect2.fireeye.com/v1/url?k=4f
> 9d8ae4-2e169fde-4f9c01ab-74fe4860008a-
> b5cd486f43ed047d&q=1&e=07140046-8b99-485a-a6cf-
> 0c1685707a67&u=https*3A*2F*2Fgithub.com*2FOpenMPDK*2FxNVMe
> __;JSUlJSU!!EwVzqGoTKBqv-
> 0DWAJBm!ChkUAg8V4FGdLAgw54MUDD8PRpVmo1RBeReZpfMKxWz8a
> DMsUtG1GYPPc9rhJqXGQ87L$
> 
> Co-Authored-By: Ankit Kumar <ankit.kumar@xxxxxxxxxxx>
> Co-Authored-By: Simon A. F. Lund <simon.lund@xxxxxxxxxxx>
> Co-Authored-By: Mads Ynddal <m.ynddal@xxxxxxxxxxx>
> Co-Authored-By: Michael Bang <mi.bang@xxxxxxxxxxx>
> Co-Authored-By: Karl Bonde Torp <k.torp@xxxxxxxxxxx>
> Co-Authored-By: Gurmeet Singh <gur.singh@xxxxxxxxxxx>
> Co-Authored-By: Pierre Labat <plabat@xxxxxxxxxx>
> ---

<snip>

Do we need an SPDX license identifier at the top of xnvme.c?

> +++ b/engines/xnvme.c
> @@ -0,0 +1,1000 @@
> +/*
> + * fio xNVMe IO Engine
> + *
> + * IO engine using the xNVMe C API.
> + *

<snip>

> +static void xnvme_fioe_cleanup(struct thread_data *td)
> +{
> +	struct xnvme_fioe_data *xd = td->io_ops_data;
> +	int err;
> +
> +	err = pthread_mutex_lock(&g_serialize);
> +	if (err)
> +		XNVME_DEBUG("FAILED: pthread_mutex_lock(),
> err: %d", err);
> +		/* NOTE: not returning here */
> +
> +	for (uint64_t i = 0; i < xd->nallocated; ++i) {
> +		int err;
> +
> +		err = _dev_close(td, &xd->files[i]);
> +		if (err)
> +			XNVME_DEBUG("xnvme_fioe: cleanup():
> Unexpected error");
> +	}
> +	err = pthread_mutex_unlock(&g_serialize);
> +	if (err)
> +		XNVME_DEBUG("FAILED: pthread_mutex_unlock(),
> err: %d", err);
> +
> +	free(xd->iocq);
> +	free(xd->iovec);
> +	free(xd);
> +	td->io_ops_data = NULL;
> +}

If we fail to acquire the lock above we should not try to unlock it. Also, we
declare err a second time inside the for loop.

With the minor issues addressed:

Reviewed-by: Vincent Fu <vincent.fu@xxxxxxxxxxx>




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux