mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cache: fix reporting of dirty cache
When cache has zero used blocks it's been wrongly reported as 100.00% dirty. Fix it and report 0.00.
This commit is contained in:
parent
9350aa7218
commit
454b891f6d
@ -1,5 +1,6 @@
|
||||
Version 2.02.166 -
|
||||
=====================================
|
||||
Report 0% as dirty (copy%) for cache without any used block.
|
||||
Fix lvm2api reporting of cache data and metadata percent.
|
||||
Restore reporting of metadata usage for cache volumes (2.02.155).
|
||||
Support raid scrubbing on cache origin LV.
|
||||
|
@ -1432,8 +1432,9 @@ int dev_manager_cache_status(struct dev_manager *dm,
|
||||
c->total_blocks);
|
||||
(*status)->metadata_usage = dm_make_percent(c->metadata_used_blocks,
|
||||
c->metadata_total_blocks);
|
||||
(*status)->dirty_usage = dm_make_percent(c->dirty_blocks,
|
||||
c->used_blocks);
|
||||
(*status)->dirty_usage = (s->cache->used_blocks) ?
|
||||
dm_make_percent(c->dirty_blocks,
|
||||
c->used_blocks) : DM_PERCENT_0;
|
||||
}
|
||||
r = 1;
|
||||
out:
|
||||
|
@ -366,8 +366,9 @@ dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_an
|
||||
else {
|
||||
switch (type) {
|
||||
case PERCENT_GET_DIRTY:
|
||||
p = dm_make_percent(s->cache->dirty_blocks,
|
||||
s->cache->used_blocks);
|
||||
p = (s->cache->used_blocks) ?
|
||||
dm_make_percent(s->cache->dirty_blocks,
|
||||
s->cache->used_blocks) : DM_PERCENT_0;
|
||||
break;
|
||||
case PERCENT_GET_METADATA:
|
||||
p = dm_make_percent(s->cache->metadata_used_blocks,
|
||||
|
@ -85,15 +85,15 @@ lvremove -f $vg
|
||||
lvcreate --type cache-pool -L1 $vg/cpool
|
||||
lvcreate -H -L4 -n $lv1 $vg/cpool
|
||||
|
||||
check lv_field $vg/$lv1 copy_percent "100.00"
|
||||
check lv_field $vg/$lv1 copy_percent "0.00"
|
||||
check lv_field $vg/$lv1 data_percent "0.00"
|
||||
check lv_field $vg/$lv1 metadata_percent "0.78"
|
||||
check lv_field $vg/cpool copy_percent "100.00"
|
||||
check lv_field $vg/cpool copy_percent "0.00"
|
||||
check lv_field $vg/cpool data_percent "0.00"
|
||||
check lv_field $vg/cpool metadata_percent "0.78"
|
||||
# check we also display percent value for segmented output (-o+devices)
|
||||
lvs -a -o+devices $vg/cpool | tee out
|
||||
grep "100.00" out
|
||||
grep "0.00" out
|
||||
lvremove -f $vg
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user