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

@@ -170,7 +170,7 @@ struct ocf_mpool *ocf_mpool_create(struct ocf_cache *cache,
mpool->cache = cache;
mpool->flags = flags;
for (i = 0; i < min(ocf_mpool_max, mpool_max + 1); i++) {
for (i = 0; i < OCF_MIN(ocf_mpool_max, mpool_max + 1); i++) {
result = snprintf(name, sizeof(name), "%s_%u", name_perfix,
(1 << i));
if (result < 0 || result >= sizeof(name))

View File

@@ -60,7 +60,7 @@ static inline uint64_t ocf_bytes_2_lines(struct ocf_cache *cache,
static inline uint64_t ocf_bytes_2_lines_round_up(
struct ocf_cache *cache, uint64_t bytes)
{
return DIV_ROUND_UP(bytes, ocf_line_size(cache));
return OCF_DIV_ROUND_UP(bytes, ocf_line_size(cache));
}
static inline uint64_t ocf_lines_2_bytes(struct ocf_cache *cache,

View File

@@ -92,7 +92,7 @@ int ocf_submit_obj_discard_wait(ocf_data_obj_t obj, uint64_t addr,
break;
}
bytes = min(length, max_length);
bytes = OCF_MIN(length, max_length);
env_atomic_inc(&cntx.req_remaining);
@@ -139,7 +139,7 @@ int ocf_submit_write_zeroes_wait(ocf_data_obj_t obj, uint64_t addr,
while (length) {
env_completion_init(&cntx.complete);
bytes = MIN(length, max_length);
bytes = OCF_MIN(length, max_length);
ocf_io_configure(io, addr, bytes, OCF_WRITE, 0, 0);
ocf_io_set_cmpl(io, &cntx, NULL,

View File

@@ -253,7 +253,7 @@ struct ocf_request *ocf_req_new_discard(struct ocf_cache *cache,
struct ocf_request *req;
req = ocf_req_new_extended(cache, core_id, addr,
MIN(bytes, MAX_TRIM_RQ_SIZE),rw);
OCF_MIN(bytes, MAX_TRIM_RQ_SIZE),rw);
if (!req)
return NULL;