1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Cease recognising snapshot-in-use percentages returned by early development kernels.

This commit is contained in:
Alasdair Kergon 2008-07-15 00:25:52 +00:00
parent 0745f76ebe
commit 82185ada82
5 changed files with 11 additions and 18 deletions

View File

@ -1,6 +1,7 @@
Version 2.02.40 - 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) Fix dmeventd monitoring libraries to link against liblvm2cmd again. (2.02.39)
Version 2.02.39 - 27th June 2008 Version 2.02.39 - 27th June 2008

View File

@ -379,8 +379,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
!segtype->ops->target_percent(&dm->target_state, dm->mem, !segtype->ops->target_percent(&dm->target_state, dm->mem,
dm->cmd, seg, params, dm->cmd, seg, params,
&total_numerator, &total_numerator,
&total_denominator, &total_denominator))
percent))
goto_out; goto_out;
} while (next); } while (next);
@ -393,7 +392,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (total_denominator) if (total_denominator)
*percent = (float) total_numerator *100 / total_denominator; *percent = (float) total_numerator *100 / total_denominator;
else if (*percent < 0) else
*percent = 100; *percent = 100;
log_debug("LV percent: %f", *percent); log_debug("LV percent: %f", *percent);

View File

@ -77,7 +77,7 @@ struct segtype_handler {
struct cmd_context *cmd, struct cmd_context *cmd,
struct lv_segment *seg, char *params, struct lv_segment *seg, char *params,
uint64_t *total_numerator, uint64_t *total_numerator,
uint64_t *total_denominator, float *percent); uint64_t *total_denominator);
int (*target_present) (const struct lv_segment *seg, int (*target_present) (const struct lv_segment *seg,
unsigned *attributes); unsigned *attributes);
int (*modules_needed) (struct dm_pool *mem, int (*modules_needed) (struct dm_pool *mem,

View File

@ -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, static int _mirrored_target_percent(void **target_state, struct dm_pool *mem,
struct cmd_context *cmd, struct lv_segment *seg, struct cmd_context *cmd, struct lv_segment *seg,
char *params, uint64_t *total_numerator, char *params, uint64_t *total_numerator,
uint64_t *total_denominator, uint64_t *total_denominator)
float *percent __attribute((unused)))
{ {
struct mirror_state *mirr_state; struct mirror_state *mirr_state;
uint64_t numerator, denominator; uint64_t numerator, denominator;

View File

@ -95,20 +95,14 @@ static int _snap_target_percent(void **target_state __attribute((unused)),
struct cmd_context *cmd __attribute((unused)), struct cmd_context *cmd __attribute((unused)),
struct lv_segment *seg __attribute((unused)), struct lv_segment *seg __attribute((unused)),
char *params, uint64_t *total_numerator, char *params, uint64_t *total_numerator,
uint64_t *total_denominator, float *percent) uint64_t *total_denominator)
{ {
float percent2;
uint64_t numerator, denominator; uint64_t numerator, denominator;
if (strchr(params, '/')) { if (sscanf(params, "%" PRIu64 "/%" PRIu64,
if (sscanf(params, "%" PRIu64 "/%" PRIu64, &numerator, &denominator) == 2) {
&numerator, &denominator) == 2) { *total_numerator += numerator;
*total_numerator += numerator; *total_denominator += denominator;
*total_denominator += denominator;
}
} else if (sscanf(params, "%f", &percent2) == 1) {
*percent += percent2;
*percent /= 2;
} }
return 1; return 1;