Commit 6c54c13c authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Daniel Verkamp
Browse files

event/subsystem/bdev: asynchronous SPDK finish



First this change moves spdk_subsystem_fini() to trigger on
spdk_app_stop(). This ensures that spdk_subsystem_fini() is called
before reactors are stopped in spdk_reactors_stop().

Finish paths for subsystems, bdevs and copy engine is now
asynchronous.
Each of those three mentioned have to make sure they are
asynchronous as well.

Only bdev that currently has requirement for asynchronous finish
are logical volume.
Thus the change in vbdev_lvol.c making it move to next bdev module
only after all lvol stores were unloaded.

Fio_plugin finish of bdev and copy_engine was removed for now.
Next patch in series adds it back with async support.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I80ee2d084f3d82c50bf1329e08996604ae61b1b3
Reviewed-on: https://review.gerrithub.io/381536


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 071cc42c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -648,7 +648,5 @@ static void fio_init spdk_fio_register(void)

static void fio_exit spdk_fio_unregister(void)
{
	spdk_bdev_finish();
	spdk_copy_engine_finish();
	unregister_ioengine(&ioengine);
}
+2 −1
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ struct spdk_bdev_io_stat {
struct spdk_bdev_poller;

typedef void (*spdk_bdev_init_cb)(void *cb_arg, int rc);
typedef void (*spdk_bdev_fini_cb)(void *cb_arg);

typedef void (*spdk_bdev_poller_fn)(void *arg);
typedef void (*spdk_bdev_poller_start_cb)(struct spdk_bdev_poller **ppoller,
@@ -126,7 +127,7 @@ typedef void (*spdk_bdev_poller_stop_cb)(struct spdk_bdev_poller **ppoller);
void spdk_bdev_initialize(spdk_bdev_init_cb cb_fn, void *cb_arg,
			  spdk_bdev_poller_start_cb start_poller_fn,
			  spdk_bdev_poller_stop_cb stop_poller_fn);
void spdk_bdev_finish(void);
void spdk_bdev_finish(spdk_bdev_fini_cb cb_fn, void *cb_arg);
void spdk_bdev_config_text(FILE *fp);

struct spdk_bdev *spdk_bdev_get_by_name(const char *bdev_name);
+3 −1
Original line number Diff line number Diff line
@@ -41,13 +41,15 @@
#include "spdk/stdinc.h"

typedef void (*spdk_copy_completion_cb)(void *ref, int status);
typedef void (*spdk_copy_fini_cb)(void *cb_arg);

struct spdk_io_channel;

struct spdk_copy_task;

int spdk_copy_engine_initialize(void);
void spdk_copy_engine_finish(void);
void spdk_copy_engine_finish(spdk_copy_fini_cb cb_fn, void *cb_arg);
void spdk_copy_engine_module_finish(void);

struct spdk_io_channel *spdk_copy_engine_get_io_channel(void);
int spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst,
+17 −1
Original line number Diff line number Diff line
@@ -121,6 +121,11 @@ struct spdk_bdev_module_if {
	 */
	uint32_t action_in_progress;

	/**
	 * Denotes if the module_fini function may complete asynchronously.
	 */
	bool async_fini;

	TAILQ_ENTRY(spdk_bdev_module_if) tailq;
};

@@ -380,6 +385,7 @@ void spdk_vbdev_unregister(struct spdk_bdev *vbdev, spdk_bdev_unregister_cb cb_f

void spdk_bdev_module_examine_done(struct spdk_bdev_module_if *module);
void spdk_bdev_module_init_done(struct spdk_bdev_module_if *module);
void spdk_bdev_module_finish_done(void);
int spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
				struct spdk_bdev_module_if *module);
void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);
@@ -536,7 +542,7 @@ void spdk_bdev_part_submit_request(struct spdk_bdev_part_channel *ch, struct spd

/*
 * Set module initialization to be asynchronous. After using this macro, the module
 * initialization has to be explicitly finished by calling spdk_bdev_module_init_done().
 * initialization has to be explicitly completed by calling spdk_bdev_module_init_done().
 */
#define SPDK_BDEV_MODULE_ASYNC_INIT(name)							\
	__attribute__((constructor)) static void name ## _async_init(void)			\
@@ -544,6 +550,16 @@ void spdk_bdev_part_submit_request(struct spdk_bdev_part_channel *ch, struct spd
		SPDK_GET_BDEV_MODULE(name)->action_in_progress = 1;				\
	}

/*
 * Set module finish to be asynchronous. After using this macro, the module
 * finishing has to be explicitly completed by calling spdk_bdev_module_fini_done().
 */
#define SPDK_BDEV_MODULE_ASYNC_FINI(name)							\
	__attribute__((constructor)) static void name ## _async_fini(void)			\
	{											\
		SPDK_GET_BDEV_MODULE(name)->async_fini = true;					\
	}

/*
 * Modules are not required to use this macro.  It allows modules to reference the module with
 * SPDK_GET_BDEV_MODULE() before it is defined by SPDK_BDEV_MODULE_REGISTER.
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ struct spdk_copy_module_if {
	 *
	 *  Modules are not required to define this function.
	 */
	void	(*module_fini)(void);
	void	(*module_fini)(void *ctx);

	/** Function called to return a text string representing the
	 *   module's configuration options for inclusion in an
Loading