master - thin: validate mapped size of thin volume
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=df110bccbed2bc7f53355fcb16309eb2727ba483 Commit: df110bccbed2bc7f53355fcb16309eb2727ba483 Parent: a01eb9c451b136ccb12f3baf6b487604a4f209dc Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Sep 3 22:52:21 2015 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu Sep 3 23:34:36 2015 +0200
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.
--- lib/thin/thin.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
lib/thin/thin.c +9 -0
@@ -620,6 +620,15 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),/* Pool allocates whole chunk so round-up to nearest one */ csize =first_seg (seg->pool_lv)->chunk_size; 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); *total_denominator += csize; }else {