mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
thin: validate mapped size of thin volume
Never show we map more then 100% for a volume. But show warning when there could be some consistency problems.
This commit is contained in:
parent
a01eb9c451
commit
df110bccbe
@ -620,6 +620,15 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
|
|||||||
/* Pool allocates whole chunk so round-up to nearest one */
|
/* Pool allocates whole chunk so round-up to nearest one */
|
||||||
csize = first_seg(seg->pool_lv)->chunk_size;
|
csize = first_seg(seg->pool_lv)->chunk_size;
|
||||||
csize = ((seg->lv->size + csize - 1) / csize) * csize;
|
csize = ((seg->lv->size + csize - 1) / csize) * csize;
|
||||||
|
if (s->mapped_sectors > csize) {
|
||||||
|
log_warn("WARNING: LV %s maps %s while the size is only %s.",
|
||||||
|
display_lvname(seg->lv),
|
||||||
|
display_size(cmd, s->mapped_sectors),
|
||||||
|
display_size(cmd, csize));
|
||||||
|
/* Don't show nonsense numbers like i.e. 1000% full */
|
||||||
|
s->mapped_sectors = csize;
|
||||||
|
}
|
||||||
|
|
||||||
*percent = dm_make_percent(s->mapped_sectors, csize);
|
*percent = dm_make_percent(s->mapped_sectors, csize);
|
||||||
*total_denominator += csize;
|
*total_denominator += csize;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user