Update OCF

Remove metadata updater
Update mpool API

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
This commit is contained in:
Kozlowski Mateusz 2021-06-21 16:45:21 +02:00
parent 877772734e
commit 647124895f
9 changed files with 8 additions and 95 deletions

View File

@ -282,21 +282,6 @@ static void _cas_ctx_cleaner_stop(ocf_cleaner_t c)
return cas_stop_cleaner_thread(c); return cas_stop_cleaner_thread(c);
} }
static int _cas_ctx_metadata_updater_init(ocf_metadata_updater_t mu)
{
return cas_create_metadata_updater_thread(mu);
}
static void _cas_ctx_metadata_updater_kick(ocf_metadata_updater_t mu)
{
return cas_kick_metadata_updater_thread(mu);
}
static void _cas_ctx_metadata_updater_stop(ocf_metadata_updater_t mu)
{
return cas_stop_metadata_updater_thread(mu);
}
#define CAS_LOG_FORMAT_STRING_MAX_LEN 256 #define CAS_LOG_FORMAT_STRING_MAX_LEN 256
static int _cas_ctx_logger_open(ocf_logger_t logger) static int _cas_ctx_logger_open(ocf_logger_t logger)
@ -406,12 +391,6 @@ static const struct ocf_ctx_config ctx_cfg = {
.stop = _cas_ctx_cleaner_stop, .stop = _cas_ctx_cleaner_stop,
}, },
.metadata_updater = {
.init = _cas_ctx_metadata_updater_init,
.kick = _cas_ctx_metadata_updater_kick,
.stop = _cas_ctx_metadata_updater_stop,
},
.logger = { .logger = {
.open = _cas_ctx_logger_open, .open = _cas_ctx_logger_open,
.close = _cas_ctx_logger_close, .close = _cas_ctx_logger_close,
@ -434,7 +413,7 @@ int cas_initialize_context(void)
cas_bvec_pool = env_mpool_create(sizeof(struct blk_data), cas_bvec_pool = env_mpool_create(sizeof(struct blk_data),
sizeof(struct bio_vec), GFP_NOIO, 7, true, NULL, sizeof(struct bio_vec), GFP_NOIO, 7, true, NULL,
"cas_biovec"); "cas_biovec", true);
if (!cas_bvec_pool) { if (!cas_bvec_pool) {
printk(KERN_ERR "Cannot create BIO vector memory pool\n"); printk(KERN_ERR "Cannot create BIO vector memory pool\n");

View File

@ -2048,7 +2048,7 @@ int cache_mngt_init_instance(struct ocf_mngt_cache_config *cfg,
/* Start cache. Returned cache instance will be locked as it was set /* Start cache. Returned cache instance will be locked as it was set
* in configuration. * in configuration.
*/ */
result = ocf_mngt_cache_start(cas_ctx, &cache, cfg); result = ocf_mngt_cache_start(cas_ctx, &cache, cfg, NULL);
if (result) { if (result) {
kthread_stop(context->rollback_thread); kthread_stop(context->rollback_thread);
kfree(context); kfree(context);

View File

@ -174,7 +174,7 @@ err:
return NULL; return NULL;
} }
env_allocator *env_allocator_create(uint32_t size, const char *name) env_allocator *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);
} }

View File

@ -82,7 +82,7 @@ typedef struct _env_allocator env_allocator;
env_allocator *env_allocator_create_extended(uint32_t size, const char *name, env_allocator *env_allocator_create_extended(uint32_t size, const char *name,
int rpool_limit); int rpool_limit);
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);

View File

@ -115,38 +115,6 @@ static int _cas_cleaner_thread(void *data)
return 0; return 0;
} }
static int _cas_metadata_updater_thread(void *data)
{
ocf_metadata_updater_t mu = data;
struct cas_thread_info *info;
BUG_ON(!mu);
/* complete the creation of the thread */
info = ocf_metadata_updater_get_priv(mu);
BUG_ON(!info);
CAS_DAEMONIZE(info->thread->comm);
complete(&info->compl);
do {
if (atomic_read(&info->stop))
break;
atomic_set(&info->kicked, 0);
if (ocf_metadata_updater_run(mu))
continue;
wait_event_interruptible(info->wq, atomic_read(&info->stop) ||
atomic_read(&info->kicked));
} while (true);
complete_and_exit(&info->compl, 0);
return 0;
}
static int _cas_create_thread(struct cas_thread_info **pinfo, static int _cas_create_thread(struct cas_thread_info **pinfo,
int (*threadfn)(void *), void *priv, int cpu, int (*threadfn)(void *), void *priv, int cpu,
const char *fmt, ...) const char *fmt, ...)
@ -274,34 +242,3 @@ void cas_stop_cleaner_thread(ocf_cleaner_t c)
_cas_stop_thread(info); _cas_stop_thread(info);
} }
int cas_create_metadata_updater_thread(ocf_metadata_updater_t mu)
{
struct cas_thread_info *info;
int result;
result = _cas_create_thread(&info, _cas_metadata_updater_thread,
mu, CAS_CPUS_ALL, "cas_mu_%s",
ocf_cache_get_name(ocf_metadata_updater_get_cache(mu)));
if (!result) {
ocf_metadata_updater_set_priv(mu, info);
_cas_start_thread(info);
}
return result;
}
void cas_kick_metadata_updater_thread(ocf_metadata_updater_t mu)
{
struct cas_thread_info *info = ocf_metadata_updater_get_priv(mu);
atomic_set(&info->kicked, 1);
wake_up(&info->wq);
}
void cas_stop_metadata_updater_thread(ocf_metadata_updater_t mu)
{
struct cas_thread_info *info = ocf_metadata_updater_get_priv(mu);
ocf_metadata_updater_set_priv(mu, NULL);
_cas_stop_thread(info);
}

View File

@ -20,8 +20,4 @@ int cas_create_cleaner_thread(ocf_cleaner_t c);
void cas_kick_cleaner_thread(ocf_cleaner_t c); void cas_kick_cleaner_thread(ocf_cleaner_t c);
void cas_stop_cleaner_thread(ocf_cleaner_t c); void cas_stop_cleaner_thread(ocf_cleaner_t c);
int cas_create_metadata_updater_thread(ocf_metadata_updater_t mu);
void cas_kick_metadata_updater_thread(ocf_metadata_updater_t mu);
void cas_stop_metadata_updater_thread(ocf_metadata_updater_t mu);
#endif /* __THREADS_H__ */ #endif /* __THREADS_H__ */

View File

@ -29,7 +29,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)
{ {
uint32_t i; uint32_t i;
char name[MPOOL_ALLOCATOR_NAME_MAX] = { '\0' }; char name[MPOOL_ALLOCATOR_NAME_MAX] = { '\0' };

View File

@ -37,13 +37,14 @@ struct env_mpool;
* order or NULL if defaults are to be used. Array should have * order or NULL if defaults are to be used. Array should have
* mpool_max elements * mpool_max elements
* @param name_prefix Format name prefix * @param name_prefix Format name prefix
* @param zero Unused parameter
* *
* @return CAS memory pool * @return CAS memory pool
*/ */
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_prefix, bool zero);
/** /**
* @brief Destroy existing memory pool * @brief Destroy existing memory pool

2
ocf

@ -1 +1 @@
Subproject commit 5b3a9606d3eab2e1157d2d692d1f4879fbb527ae Subproject commit 73c3e97f43b482ed8162d18314054a0b5d4b5d69