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:
@@ -85,11 +85,11 @@ static ocf_cache_line_t ocf_metadata_hash_get_entires(
|
||||
OCF_HASH_PRIME - 1;
|
||||
|
||||
case metadata_segment_sb_config:
|
||||
return DIV_ROUND_UP(sizeof(struct ocf_superblock_config),
|
||||
return OCF_DIV_ROUND_UP(sizeof(struct ocf_superblock_config),
|
||||
PAGE_SIZE);
|
||||
|
||||
case metadata_segment_sb_runtime:
|
||||
return DIV_ROUND_UP(sizeof(struct ocf_superblock_runtime),
|
||||
return OCF_DIV_ROUND_UP(sizeof(struct ocf_superblock_runtime),
|
||||
PAGE_SIZE);
|
||||
|
||||
case metadata_segment_reserved:
|
||||
@@ -247,7 +247,7 @@ static int ocf_metadata_hash_calculate_metadata_size(
|
||||
* Setup SSD location and size
|
||||
*/
|
||||
raw->ssd_pages_offset = count_pages;
|
||||
raw->ssd_pages = DIV_ROUND_UP(raw->entries,
|
||||
raw->ssd_pages = OCF_DIV_ROUND_UP(raw->entries,
|
||||
raw->entries_in_page);
|
||||
|
||||
/* Update offset for next container */
|
||||
@@ -495,7 +495,7 @@ static int ocf_metadata_hash_init(struct ocf_cache *cache,
|
||||
* Setup SSD location and size
|
||||
*/
|
||||
raw->ssd_pages_offset = page;
|
||||
raw->ssd_pages = DIV_ROUND_UP(raw->entries,
|
||||
raw->ssd_pages = OCF_DIV_ROUND_UP(raw->entries,
|
||||
raw->entries_in_page);
|
||||
|
||||
/* Update offset for next container */
|
||||
|
@@ -90,7 +90,7 @@ int metadata_io_read_i_atomic(struct ocf_cache *cache,
|
||||
count = io_sectors_count;
|
||||
for (i = 0; i < io_sectors_count; i += curr_count) {
|
||||
/* Get sectors count of this IO iteration */
|
||||
curr_count = MIN(max_sectors_count, count);
|
||||
curr_count = OCF_MIN(max_sectors_count, count);
|
||||
|
||||
env_completion_init(&meta_atom_req.complete);
|
||||
meta_atom_req.error = 0;
|
||||
@@ -268,7 +268,7 @@ int metadata_io_write_i_asynch(struct ocf_cache *cache, uint32_t queue,
|
||||
{
|
||||
uint32_t curr_count, written;
|
||||
uint32_t max_count = metadata_io_max_page(cache);
|
||||
uint32_t io_count = DIV_ROUND_UP(count, max_count);
|
||||
uint32_t io_count = OCF_DIV_ROUND_UP(count, max_count);
|
||||
uint32_t i, i_fill;
|
||||
int error = 0, ret;
|
||||
struct ocf_io *io;
|
||||
@@ -546,7 +546,7 @@ static int metadata_io(struct metadata_io *mio)
|
||||
env_completion_init(&mio->completion);
|
||||
|
||||
while (count) {
|
||||
this_count = MIN(count, max_count);
|
||||
this_count = OCF_MIN(count, max_count);
|
||||
|
||||
err = metadata_submit_io(cache, mio, this_count, written);
|
||||
if (err)
|
||||
|
@@ -128,7 +128,7 @@ static uint32_t _raw_ram_size_on_ssd(struct ocf_cache *cache,
|
||||
{
|
||||
const size_t alignment = 128 * KiB / PAGE_SIZE;
|
||||
|
||||
return DIV_ROUND_UP(raw->ssd_pages, alignment) * alignment;
|
||||
return OCF_DIV_ROUND_UP(raw->ssd_pages, alignment) * alignment;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -190,7 +190,7 @@ uint32_t raw_dynamic_size_on_ssd(struct ocf_cache *cache,
|
||||
{
|
||||
const size_t alignment = 128 * KiB / PAGE_SIZE;
|
||||
|
||||
return DIV_ROUND_UP(raw->ssd_pages, alignment) * alignment;
|
||||
return OCF_DIV_ROUND_UP(raw->ssd_pages, alignment) * alignment;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user