OCF provides own macros for MIN, MAX, and DIV_ROUND_UP

Signed-off-by: Mariusz Barczak <mariusz.barczak@intel.com>
This commit is contained in:
Mariusz Barczak
2018-12-13 05:14:39 -05:00
parent abb8dc5067
commit 15ed5b4450
17 changed files with 28 additions and 35 deletions

View File

@@ -210,8 +210,8 @@ static unsigned long _ocf_mngt_find_first_free_core(const unsigned long *bitmap)
for (i = 0; i * sizeof(unsigned long) * 8 < OCF_CORE_MAX; i++) {
unsigned long long ignore_mask = (i == 0) ? 1UL : 0UL;
if (~(bitmap[i] | ignore_mask)) {
ret = MIN(OCF_CORE_MAX, i * sizeof(unsigned long) * 8 +
_ffz(bitmap[i] | ignore_mask));
ret = OCF_MIN(OCF_CORE_MAX, i * sizeof(unsigned long) *
8 + _ffz(bitmap[i] | ignore_mask));
break;
}
}
@@ -243,7 +243,7 @@ static int __ocf_mngt_lookup_core_uuid(ocf_cache_t cache,
}
if (!env_strncmp(core->obj.uuid.data, cfg->uuid.data,
min(core->obj.uuid.size,
OCF_MIN(core->obj.uuid.size,
cfg->uuid.size)))
return i;
}

View File

@@ -83,7 +83,7 @@ ocf_data_obj_t ocf_mngt_core_pool_lookup(ocf_ctx_t ctx, ocf_uuid_t uuid,
list_for_each_entry(sobj, &ctx->core_pool.core_pool_head,
core_pool_item) {
if (sobj->type == type && !env_strncmp(sobj->uuid.data,
uuid->data, min(sobj->uuid.size, uuid->size))) {
uuid->data, OCF_MIN(sobj->uuid.size, uuid->size))) {
return sobj;
}
}

View File

@@ -264,10 +264,10 @@ static void _ocf_mngt_flush_portion(struct flush_container *fc)
/* regardless those calculations, limit flush portion to be
* between OCF_MNG_FLUSH_MIN and OCF_MNG_FLUSH_MAX
*/
fc->flush_portion = MIN(fc->flush_portion, OCF_MNG_FLUSH_MAX);
fc->flush_portion = MAX(fc->flush_portion, OCF_MNG_FLUSH_MIN);
fc->flush_portion = OCF_MIN(fc->flush_portion, OCF_MNG_FLUSH_MAX);
fc->flush_portion = OCF_MAX(fc->flush_portion, OCF_MNG_FLUSH_MIN);
curr_count = MIN(fc->count - fc->iter, fc->flush_portion);
curr_count = OCF_MIN(fc->count - fc->iter, fc->flush_portion);
ocf_cleaner_do_flush_data_async(fc->cache,
&fc->flush_data[fc->iter],