Update ocf to 21.6
- remove metadata updater - handle 'zero' flag in mempool allocator - adapt ocf_mngt_cache_start() to new OCF API Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com> Change-Id: I34afd856cc1306ffe305f71a445e7474c9b0a2d9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9129 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
da04add8d2
commit
6bb2c02c54
@ -58,7 +58,7 @@ struct env_mpool {
|
|||||||
struct env_mpool *env_mpool_create(uint32_t hdr_size, uint32_t elem_size,
|
struct env_mpool *env_mpool_create(uint32_t hdr_size, uint32_t elem_size,
|
||||||
int flags, int mpool_max, bool fallback,
|
int flags, int mpool_max, bool fallback,
|
||||||
const uint32_t limits[env_mpool_max],
|
const uint32_t limits[env_mpool_max],
|
||||||
const char *name_perfix)
|
const char *name_perfix, bool zero)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char name[MEMPOOL_SIZE] = {};
|
char name[MEMPOOL_SIZE] = {};
|
||||||
@ -84,7 +84,7 @@ struct env_mpool *env_mpool_create(uint32_t hdr_size, uint32_t elem_size,
|
|||||||
size = hdr_size + (elem_size * (1 << i));
|
size = hdr_size + (elem_size * (1 << i));
|
||||||
|
|
||||||
mpool->allocator[i] = env_allocator_create_extended(size, name,
|
mpool->allocator[i] = env_allocator_create_extended(size, name,
|
||||||
limits ? limits[i] : -1);
|
limits ? limits[i] : -1, zero);
|
||||||
|
|
||||||
if (!mpool->allocator[i]) {
|
if (!mpool->allocator[i]) {
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -52,7 +52,7 @@ struct env_mpool;
|
|||||||
struct env_mpool *env_mpool_create(uint32_t hdr_size, uint32_t elem_size,
|
struct env_mpool *env_mpool_create(uint32_t hdr_size, uint32_t elem_size,
|
||||||
int flags, int mpool_max, bool fallback,
|
int flags, int mpool_max, bool fallback,
|
||||||
const uint32_t limits[env_mpool_max],
|
const uint32_t limits[env_mpool_max],
|
||||||
const char *name_perfix);
|
const char *name_perfix, bool zero);
|
||||||
|
|
||||||
void env_mpool_destroy(struct env_mpool *mpools);
|
void env_mpool_destroy(struct env_mpool *mpools);
|
||||||
|
|
||||||
|
@ -55,7 +55,11 @@ env_allocator_new(env_allocator *allocator)
|
|||||||
{
|
{
|
||||||
void *mem = spdk_mempool_get(allocator->mempool);
|
void *mem = spdk_mempool_get(allocator->mempool);
|
||||||
|
|
||||||
if (spdk_likely(mem)) {
|
if (spdk_unlikely(!mem)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allocator->zero) {
|
||||||
memset(mem, 0, allocator->element_size);
|
memset(mem, 0, allocator->element_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,13 +67,13 @@ env_allocator_new(env_allocator *allocator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
env_allocator *
|
env_allocator *
|
||||||
env_allocator_create(uint32_t size, const char *name)
|
env_allocator_create(uint32_t size, const char *name, bool zero)
|
||||||
{
|
{
|
||||||
return env_allocator_create_extended(size, name, -1);
|
return env_allocator_create_extended(size, name, -1, zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
env_allocator *
|
env_allocator *
|
||||||
env_allocator_create_extended(uint32_t size, const char *name, int limit)
|
env_allocator_create_extended(uint32_t size, const char *name, int limit, bool zero)
|
||||||
{
|
{
|
||||||
env_allocator *allocator;
|
env_allocator *allocator;
|
||||||
char qualified_name[128] = {0};
|
char qualified_name[128] = {0};
|
||||||
@ -94,6 +98,7 @@ env_allocator_create_extended(uint32_t size, const char *name, int limit)
|
|||||||
|
|
||||||
allocator->element_size = size;
|
allocator->element_size = size;
|
||||||
allocator->element_count = GET_ELEMENTS_COUNT(limit);
|
allocator->element_count = GET_ELEMENTS_COUNT(limit);
|
||||||
|
allocator->zero = zero;
|
||||||
|
|
||||||
return allocator;
|
return allocator;
|
||||||
}
|
}
|
||||||
|
@ -184,11 +184,12 @@ typedef struct {
|
|||||||
struct spdk_mempool *mempool;
|
struct spdk_mempool *mempool;
|
||||||
size_t element_size;
|
size_t element_size;
|
||||||
size_t element_count;
|
size_t element_count;
|
||||||
|
bool zero;
|
||||||
} env_allocator;
|
} env_allocator;
|
||||||
|
|
||||||
env_allocator *env_allocator_create_extended(uint32_t size, const char *name, int limit);
|
env_allocator *env_allocator_create_extended(uint32_t size, const char *name, int limit, bool zero);
|
||||||
|
|
||||||
env_allocator *env_allocator_create(uint32_t size, const char *name);
|
env_allocator *env_allocator_create(uint32_t size, const char *name, bool zero);
|
||||||
|
|
||||||
void env_allocator_destroy(env_allocator *allocator);
|
void env_allocator_destroy(env_allocator *allocator);
|
||||||
|
|
||||||
|
@ -431,49 +431,6 @@ vbdev_ocf_ctx_cleaner_kick(ocf_cleaner_t cleaner)
|
|||||||
priv->poller = SPDK_POLLER_REGISTER(cleaner_poll, cleaner, 0);
|
priv->poller = SPDK_POLLER_REGISTER(cleaner_poll, cleaner, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
vbdev_ocf_md_kick(void *ctx)
|
|
||||||
{
|
|
||||||
ocf_metadata_updater_t mu = ctx;
|
|
||||||
ocf_cache_t cache = ocf_metadata_updater_get_cache(mu);
|
|
||||||
|
|
||||||
ocf_metadata_updater_run(mu);
|
|
||||||
|
|
||||||
/* Decrease cache ref count after metadata has been updated */
|
|
||||||
ocf_mngt_cache_put(cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
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_kick(ocf_metadata_updater_t mu)
|
|
||||||
{
|
|
||||||
struct spdk_thread *md_thread = ocf_metadata_updater_get_priv(mu);
|
|
||||||
ocf_cache_t cache = ocf_metadata_updater_get_cache(mu);
|
|
||||||
|
|
||||||
/* Increase cache ref count prior sending a message to a thread
|
|
||||||
* for metadata update */
|
|
||||||
ocf_mngt_cache_get(cache);
|
|
||||||
|
|
||||||
/* 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
|
/* This function is main way by which OCF communicates with user
|
||||||
* We don't want to use SPDK_LOG here because debugging information that is
|
* We don't want to use SPDK_LOG here because debugging information that is
|
||||||
* associated with every print message is not helpful in callback that only prints info
|
* associated with every print message is not helpful in callback that only prints info
|
||||||
@ -527,12 +484,6 @@ static const struct ocf_ctx_config vbdev_ocf_ctx_cfg = {
|
|||||||
.secure_erase = vbdev_ocf_ctx_data_secure_erase,
|
.secure_erase = vbdev_ocf_ctx_data_secure_erase,
|
||||||
},
|
},
|
||||||
|
|
||||||
.metadata_updater = {
|
|
||||||
.init = vbdev_ocf_volume_updater_init,
|
|
||||||
.stop = vbdev_ocf_volume_updater_stop,
|
|
||||||
.kick = vbdev_ocf_volume_updater_kick,
|
|
||||||
},
|
|
||||||
|
|
||||||
.cleaner = {
|
.cleaner = {
|
||||||
.init = vbdev_ocf_ctx_cleaner_init,
|
.init = vbdev_ocf_ctx_cleaner_init,
|
||||||
.stop = vbdev_ocf_ctx_cleaner_stop,
|
.stop = vbdev_ocf_ctx_cleaner_stop,
|
||||||
|
@ -1105,7 +1105,7 @@ start_cache(struct vbdev_ocf *vbdev)
|
|||||||
vbdev_ocf_cache_ctx_get(vbdev->cache_ctx);
|
vbdev_ocf_cache_ctx_get(vbdev->cache_ctx);
|
||||||
pthread_mutex_init(&vbdev->cache_ctx->lock, NULL);
|
pthread_mutex_init(&vbdev->cache_ctx->lock, NULL);
|
||||||
|
|
||||||
rc = ocf_mngt_cache_start(vbdev_ocf_ctx, &vbdev->ocf_cache, &vbdev->cfg.cache);
|
rc = ocf_mngt_cache_start(vbdev_ocf_ctx, &vbdev->ocf_cache, &vbdev->cfg.cache, NULL);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
SPDK_ERRLOG("Could not start cache %s: %d\n", vbdev->name, rc);
|
SPDK_ERRLOG("Could not start cache %s: %d\n", vbdev->name, rc);
|
||||||
vbdev_ocf_mngt_exit(vbdev, unregister_path_dirty, rc);
|
vbdev_ocf_mngt_exit(vbdev, unregister_path_dirty, rc);
|
||||||
|
2
ocf
2
ocf
@ -1 +1 @@
|
|||||||
Subproject commit 05401cac64b6f8f4e7050ef404ad9c78353c7cdb
|
Subproject commit 865d29d0cb93a71ce37a8410914c35005aa6ed54
|
Loading…
Reference in New Issue
Block a user