1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cache: fix parentheses for migration_threshold

When generating table line for cache target line,
the estimation of added arguments was incorrectly
calculated as the evaluation order of "?" is
made after "+".

However the result was 'masked' by the

Reported-by: Jian Cai jcai19
This commit is contained in:
Zdenek Kabelac 2021-09-10 23:02:09 +02:00
parent 30050769b1
commit 6c4cd7b2f2
3 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.181 - Version 1.02.181 -
=================================== ===================================
Fix bug in construction of cache table line (regression from 1.02.159).
Version 1.02.179 - 11th August 2021 Version 1.02.179 - 11th August 2021
=================================== ===================================

View File

@ -2644,7 +2644,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
EMIT_PARAMS(pos, " %s", name); EMIT_PARAMS(pos, " %s", name);
/* Do not pass migration_threshold 2048 which is default */ /* Do not pass migration_threshold 2048 which is default */
EMIT_PARAMS(pos, " %u", (seg->policy_argc + (seg->migration_threshold != 2048) ? 1 : 0) * 2); EMIT_PARAMS(pos, " %u", (seg->policy_argc + ((seg->migration_threshold != 2048) ? 1 : 0)) * 2);
if (seg->migration_threshold != 2048) if (seg->migration_threshold != 2048)
EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold); EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold);
if (seg->policy_settings) if (seg->policy_settings)

View File

@ -2489,7 +2489,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
EMIT_PARAMS(pos, " %s", name); EMIT_PARAMS(pos, " %s", name);
/* Do not pass migration_threshold 2048 which is default */ /* Do not pass migration_threshold 2048 which is default */
EMIT_PARAMS(pos, " %u", (seg->policy_argc + (seg->migration_threshold != 2048) ? 1 : 0) * 2); EMIT_PARAMS(pos, " %u", (seg->policy_argc + ((seg->migration_threshold != 2048) ? 1 : 0)) * 2);
if (seg->migration_threshold != 2048) if (seg->migration_threshold != 2048)
EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold); EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold);
if (seg->policy_settings) if (seg->policy_settings)