ocf: add metadata callbacks

This patch adds callback for serializing spdk metadata
stored in ocf cache devices.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449300 (master)

(cherry picked from commit fca402b0f2)
Change-Id: I856bac3d63c7172dd6c67361794159fa38812a78
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457262
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Piotr Pelplinski 2019-04-03 10:40:33 +02:00 committed by Ben Walker
parent c126086c00
commit c6b5afcec9

View File

@ -427,18 +427,41 @@ vbdev_ocf_ctx_cleaner_stop(ocf_cleaner_t c)
vbdev_ocf_queue_put(priv->queue);
}
static int vbdev_ocf_volume_updater_init(ocf_metadata_updater_t mu)
static void
vbdev_ocf_md_kick(void *ctx)
{
/* TODO [metadata]: implement with persistent metadata support */
ocf_metadata_updater_t mu = ctx;
ocf_cache_t cache = ocf_metadata_updater_get_cache(mu);
if (ocf_cache_is_running(cache)) {
ocf_metadata_updater_run(mu);
}
}
static int
vbdev_ocf_volume_updater_init(ocf_metadata_updater_t mu)
{
struct spdk_thread *md_thread = spdk_get_thread();
ocf_metadata_updater_set_priv(mu, md_thread);
return 0;
}
static void vbdev_ocf_volume_updater_stop(ocf_metadata_updater_t mu)
static void
vbdev_ocf_volume_updater_stop(ocf_metadata_updater_t mu)
{
/* TODO [metadata]: implement with persistent metadata support */
}
static void vbdev_ocf_volume_updater_kick(ocf_metadata_updater_t mu)
static void
vbdev_ocf_volume_updater_kick(ocf_metadata_updater_t mu)
{
/* TODO [metadata]: implement with persistent metadata support */
struct spdk_thread *md_thread = ocf_metadata_updater_get_priv(mu);
/* We need to send message to updater thread because
* kick can happen from any thread */
spdk_thread_send_msg(md_thread, vbdev_ocf_md_kick, mu);
}
/* This function is main way by which OCF communicates with user