From 82185ada82139da1f5f0414194c66c6976d06428 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 15 Jul 2008 00:25:52 +0000 Subject: [PATCH] Cease recognising snapshot-in-use percentages returned by early development kernels. --- WHATS_NEW | 3 ++- lib/activate/dev_manager.c | 5 ++--- lib/metadata/segtype.h | 2 +- lib/mirror/mirrored.c | 3 +-- lib/snapshot/snapshot.c | 16 +++++----------- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index caa1ceb45..3bac05317 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,7 @@ Version 2.02.40 - ================================ - Add "flags" metadata field (akin to "status") for backward-compatible flags. + Cease recognising snapshot-in-use percentages returned by early devt kernels. + Add backward-compatible flags field to on-disk format_text metadata. Fix dmeventd monitoring libraries to link against liblvm2cmd again. (2.02.39) Version 2.02.39 - 27th June 2008 diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 1b010b69d..a081dad73 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -379,8 +379,7 @@ static int _percent_run(struct dev_manager *dm, const char *name, !segtype->ops->target_percent(&dm->target_state, dm->mem, dm->cmd, seg, params, &total_numerator, - &total_denominator, - percent)) + &total_denominator)) goto_out; } while (next); @@ -393,7 +392,7 @@ static int _percent_run(struct dev_manager *dm, const char *name, if (total_denominator) *percent = (float) total_numerator *100 / total_denominator; - else if (*percent < 0) + else *percent = 100; log_debug("LV percent: %f", *percent); diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h index fa668dc16..ba9dc6e86 100644 --- a/lib/metadata/segtype.h +++ b/lib/metadata/segtype.h @@ -77,7 +77,7 @@ struct segtype_handler { struct cmd_context *cmd, struct lv_segment *seg, char *params, uint64_t *total_numerator, - uint64_t *total_denominator, float *percent); + uint64_t *total_denominator); int (*target_present) (const struct lv_segment *seg, unsigned *attributes); int (*modules_needed) (struct dm_pool *mem, diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c index 56213fb22..cbf2b77e1 100644 --- a/lib/mirror/mirrored.c +++ b/lib/mirror/mirrored.c @@ -176,8 +176,7 @@ static struct mirror_state *_mirrored_init_target(struct dm_pool *mem, static int _mirrored_target_percent(void **target_state, struct dm_pool *mem, struct cmd_context *cmd, struct lv_segment *seg, char *params, uint64_t *total_numerator, - uint64_t *total_denominator, - float *percent __attribute((unused))) + uint64_t *total_denominator) { struct mirror_state *mirr_state; uint64_t numerator, denominator; diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c index 6437970c7..911bb21a8 100644 --- a/lib/snapshot/snapshot.c +++ b/lib/snapshot/snapshot.c @@ -95,20 +95,14 @@ static int _snap_target_percent(void **target_state __attribute((unused)), struct cmd_context *cmd __attribute((unused)), struct lv_segment *seg __attribute((unused)), char *params, uint64_t *total_numerator, - uint64_t *total_denominator, float *percent) + uint64_t *total_denominator) { - float percent2; uint64_t numerator, denominator; - if (strchr(params, '/')) { - if (sscanf(params, "%" PRIu64 "/%" PRIu64, - &numerator, &denominator) == 2) { - *total_numerator += numerator; - *total_denominator += denominator; - } - } else if (sscanf(params, "%f", &percent2) == 1) { - *percent += percent2; - *percent /= 2; + if (sscanf(params, "%" PRIu64 "/%" PRIu64, + &numerator, &denominator) == 2) { + *total_numerator += numerator; + *total_denominator += denominator; } return 1;