Skip to content

Commit 1b66487

Browse files
committed
Handle dirty ratio inertia > threshold
Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
1 parent 448c310 commit 1b66487

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/cleaning/alru.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,16 @@ static bool check_for_dirty_ratio(ocf_cache_t cache,
879879
return false;
880880

881881
ctx = cache->cleaner.cleaning_policy_context;
882-
threshold = ctx->dirty_ratio_triggered
883-
? config->dirty_ratio_threshold - config->dirty_ratio_inertia
884-
: config->dirty_ratio_threshold;
882+
if (ctx->dirty_ratio_triggered) {
883+
if (config->dirty_ratio_inertia
884+
>= config->dirty_ratio_threshold)
885+
return true;
886+
887+
threshold = config->dirty_ratio_threshold
888+
- config->dirty_ratio_inertia;
889+
} else {
890+
threshold = config->dirty_ratio_threshold;
891+
}
885892

886893
ctx->dirty_ratio_triggered = info.dirty * 100 / info.size >= threshold;
887894
return ctx->dirty_ratio_triggered;

0 commit comments

Comments
 (0)