Skip to content

Commit 7fe9213

Browse files
committed
Change type of pages count variables to uint32_t
1 parent 5d8da33 commit 7fe9213

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/metadata/metadata.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
715715
OCF_DEBUG_PARAM(cache, "Metadata count pages fixed = %u", ctrl->count_pages_fixed);
716716
OCF_DEBUG_PARAM(cache, "Metadata count pages variable = %u", ctrl->count_pages_variable);
717717
OCF_DEBUG_PARAM(cache, "Metadata end pages = %u", ctrl->start_page
718-
+ ctrl->count_pages_fixed + ctrl->count_pages_variable);
718+
+ ocf_metadata_get_pages_count(cache));
719719

720720
superblock = ctrl->segment[metadata_segment_sb_config];
721721

@@ -790,7 +790,7 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
790790
ctrl->raw_desc[metadata_segment_hash].entries;
791791

792792
cache->device->metadata_offset =
793-
(ctrl->count_pages_fixed + ctrl->count_pages_variable) * PAGE_SIZE;
793+
ocf_metadata_get_pages_count(cache) * PAGE_SIZE;
794794

795795
cache->conf_meta->cachelines = ctrl->cachelines;
796796
cache->conf_meta->line_size = line_size;
@@ -949,7 +949,7 @@ void ocf_metadata_init_hash_table(ocf_pipeline_t pipeline, void *priv,
949949
/*
950950
* Get count of pages that is dedicated for metadata
951951
*/
952-
ocf_cache_line_t ocf_metadata_get_pages_count(struct ocf_cache *cache)
952+
uint32_t ocf_metadata_get_pages_count(struct ocf_cache *cache)
953953
{
954954
struct ocf_metadata_ctrl *ctrl = NULL;
955955

src/metadata/metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ocf_metadata_get_cachelines_count(struct ocf_cache *cache);
125125
* @param cache - Cache instance
126126
* @return Pages required for store metadata on cache device
127127
*/
128-
ocf_cache_line_t ocf_metadata_get_pages_count(struct ocf_cache *cache);
128+
uint32_t ocf_metadata_get_pages_count(struct ocf_cache *cache);
129129

130130
/**
131131
* @brief Flush metadata

src/metadata/metadata_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
struct ocf_metadata_ctrl {
2222
ocf_cache_line_t cachelines;
2323
ocf_cache_line_t start_page;
24-
ocf_cache_line_t count_pages_fixed;
25-
ocf_cache_line_t count_pages_variable;
24+
uint32_t count_pages_fixed;
25+
uint32_t count_pages_variable;
2626
uint32_t device_lines;
2727
size_t mapping_size;
2828
struct ocf_metadata_raw raw_desc[metadata_segment_max];

src/metadata/metadata_passive_update.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static void passive_io_page_lock_acquired(struct ocf_request *req)
7676
int ocf_metadata_passive_update(struct ocf_request *master)
7777
{
7878
ocf_cache_t cache = master->cache;
79-
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
8079
uint64_t io_start_page = BYTES_TO_PAGES(master->addr);
8180
uint64_t io_end_page = io_start_page + BYTES_TO_PAGES(master->bytes);
8281
struct ocf_request *req;
@@ -87,7 +86,7 @@ int ocf_metadata_passive_update(struct ocf_request *master)
8786
return 0;
8887
}
8988

90-
if (io_start_page >= ctrl->count_pages_fixed + ctrl->count_pages_variable) {
89+
if (io_start_page >= ocf_metadata_get_pages_count(cache)) {
9190
master->complete(master, 0);
9291
return 0;
9392
}

0 commit comments

Comments
 (0)