Commit 4fe4040a authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

nvme: Add spdk_nvme_detach_poll() to simplify a common use case



Add a new function spdk_nvme_detach_poll() to simplify a common
use case to continue polling until all detachments complete.
Then use the function for the common use case throughout.

Besides, usage by simple_copy application was not correct, and
fix it in this patch.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic14711cd8478bf221c0fe375301e77b395b37f26
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8509


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5d617b48
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ that if a controller has a CMB and supports SQs in the CMB, SPDK will not use
the CMB for SQs by default - the user must set use_cmb_sqs to true in
the spdk_nvme_ctrlr_opts structure prior to controller attach.

Add a new function `spdk_nvme_detach_poll` to simplify a common use case to continue
polling until all detachments complete.

### rpc

New RPC `bdev_rbd_register_cluster` and `bdev_rbd_unregister_cluster` was added, it allows to create
+2 −2
Original line number Diff line number Diff line
@@ -912,8 +912,8 @@ unregister_controllers(void)
		free(entry);
	}

	while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
		;
	if (detach_ctx) {
		spdk_nvme_detach_poll(detach_ctx);
	}
}

+2 −2
Original line number Diff line number Diff line
@@ -1397,8 +1397,8 @@ static void spdk_fio_cleanup(struct thread_data *td)
			free(fio_ctrlr);
		}

		while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
			;
		if (detach_ctx) {
			spdk_nvme_detach_poll(detach_ctx);
		}

		if (fio_options->enable_vmd) {
+2 −2
Original line number Diff line number Diff line
@@ -386,8 +386,8 @@ cleanup(void)
		free(ctrlr_entry);
	}

	while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
		;
	if (detach_ctx) {
		spdk_nvme_detach_poll(detach_ctx);
	}
}

+2 −2
Original line number Diff line number Diff line
@@ -1700,8 +1700,8 @@ int main(int argc, char **argv)
		spdk_nvme_detach_async(dev->ctrlr, &detach_ctx);
	}

	while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
		;
	if (detach_ctx) {
		spdk_nvme_detach_poll(detach_ctx);
	}

	return 0;
Loading