From cd4d894348b4b0e5d91c2b7b401742e483dcaf0a Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Mon, 11 Apr 2022 13:05:12 +0200 Subject: [PATCH 1/2] acp: skip the first bucket on recovering acp Since the threshold for the first bucket is always zero and the condition to exit from the loop is never met in the first iteration it is save to start iterating from `1` This change is meant to avoid confusing static code analyzers Signed-off-by: Michal Mielewczyk --- src/cleaning/acp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cleaning/acp.c b/src/cleaning/acp.c index 1a3a56f..bc2db7f 100644 --- a/src/cleaning/acp.c +++ b/src/cleaning/acp.c @@ -405,7 +405,7 @@ static void ocf_acp_recovery_chunk(struct ocf_acp_recovery_context *context, .chunk[chunk->core_id][chunk->chunk_id]; } - for (bucket_id = 0; bucket_id < ACP_MAX_BUCKETS; bucket_id++) { + for (bucket_id = 1; bucket_id < ACP_MAX_BUCKETS; bucket_id++) { bucket = &acp->bucket_info[bucket_id]; if (chunk->num_dirty < bucket->threshold) break; From e8e4e00bb7782b9f8127c78a5457096060eddb34 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Mon, 11 Apr 2022 13:28:04 +0200 Subject: [PATCH 2/2] alru: explicit upcasting Signed-off-by: Michal Mielewczyk --- src/cleaning/alru.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cleaning/alru.c b/src/cleaning/alru.c index 4ca57b9..babbde7 100644 --- a/src/cleaning/alru.c +++ b/src/cleaning/alru.c @@ -512,13 +512,13 @@ static int ocf_alru_recovery_handle(ocf_parallelize_t parallelize, ocf_part_id_t part_id; ocf_core_id_t core_id; ocf_cache_line_t cline, portion; - uint64_t begin, end; + uint32_t begin, end; uint32_t step = 0; int i; portion = DIV_ROUND_UP((uint64_t)entries, shards_cnt); begin = portion*shard_id; - end = OCF_MIN(portion*(shard_id + 1), entries); + end = OCF_MIN((uint64_t)portion*(shard_id + 1), entries); for (i = 0; i < OCF_USER_IO_CLASS_MAX; i++) { context->shard[shard_id].part[i].head = terminator;