diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-11 18:05:36 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-11 18:30:24 +0100 |
commit | 02f2916b5be3f2f1dfdb9d1a76c753e46f1e480f (patch) | |
tree | ae6b951075240dd3e377c891e49bee1071572bc8 /lib/thin | |
parent | 8423be80eea3af40355edbdb1e14eed5cd3000a2 (diff) | |
download | lvm2-02f2916b5be3f2f1dfdb9d1a76c753e46f1e480f.tar.gz |
thin: fix low_water_mark threshold calc
Reporter noticed lvm2 incorrectly translated
lvm2 threshold value to water mark in commit:
99237f0908d87592815f4bdf3c239e8a108e835c
Fix it by properly translating size to number of
blocks in thin-pool and then calc for free blocks
matching configured lvm2 threshold value.
Reported-by: Ming-Hung Tsai <mingnus@gmail.com>
Diffstat (limited to 'lib/thin')
-rw-r--r-- | lib/thin/thin.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/thin/thin.c b/lib/thin/thin.c index 9fbad32dc..c9ee9f530 100644 --- a/lib/thin/thin.c +++ b/lib/thin/thin.c @@ -295,9 +295,10 @@ static int _thin_pool_add_target_line(struct dev_manager *dm, if (threshold < 50) threshold = 50; if (threshold < 100) - low_water_mark = (len * threshold + 99) / 100; + /* Translate to number of free pool blocks to trigger watermark */ + low_water_mark = len / seg->chunk_size * (100 - threshold) / 100; else - low_water_mark = len; + low_water_mark = 0; if (!dm_tree_node_add_thin_pool_target(node, len, seg->transaction_id, |