summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--daemons/dmeventd/plugins/thin/dmeventd_thin.c18
-rw-r--r--lib/thin/thin.c31
-rw-r--r--libdm/libdevmapper.h5
-rw-r--r--libdm/libdm-deptree.c5
4 files changed, 29 insertions, 30 deletions
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index efd36bd7..039e8b37 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -38,9 +38,9 @@
struct dso_state {
struct dm_pool *mem;
- int meta_percent_check;
+ int metadata_percent_check;
int data_percent_check;
- uint64_t known_meta_size;
+ uint64_t known_metadata_size;
uint64_t known_data_size;
char cmd_str[1024];
};
@@ -183,9 +183,9 @@ void process_event(struct dm_task *dmt,
#endif
/* Thin pool size had changed. Clear the threshold. */
- if (state->known_meta_size != tps->total_meta_blocks) {
- state->meta_percent_check = CHECK_MINIMUM;
- state->known_meta_size = tps->total_meta_blocks;
+ if (state->known_metadata_size != tps->total_metadata_blocks) {
+ state->metadata_percent_check = CHECK_MINIMUM;
+ state->known_metadata_size = tps->total_metadata_blocks;
}
if (state->known_data_size != tps->total_data_blocks) {
@@ -193,13 +193,13 @@ void process_event(struct dm_task *dmt,
state->known_data_size = tps->total_data_blocks;
}
- percent = 100 * tps->used_meta_blocks / tps->total_meta_blocks;
- if (percent >= state->meta_percent_check) {
+ percent = 100 * tps->used_metadata_blocks / tps->total_metadata_blocks;
+ if (percent >= state->metadata_percent_check) {
/*
* Usage has raised more than CHECK_STEP since the last
* time. Run actions.
*/
- state->meta_percent_check = (percent / CHECK_STEP) * CHECK_STEP + CHECK_STEP;
+ state->metadata_percent_check = (percent / CHECK_STEP) * CHECK_STEP + CHECK_STEP;
/* FIXME: extension of metadata needs to be written! */
if (percent >= WARNING_THRESH) /* Print a warning to syslog. */
@@ -259,7 +259,7 @@ int register_device(const char *device,
}
state->mem = statemem;
- state->meta_percent_check = CHECK_MINIMUM;
+ state->metadata_percent_check = CHECK_MINIMUM;
state->data_percent_check = CHECK_MINIMUM;
*private = state;
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 180f9fc9..d48445f3 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2012 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -303,31 +303,28 @@ static int _thin_pool_target_percent(void **target_state __attribute__((unused))
percent_t *percent,
struct dm_pool *mem,
struct cmd_context *cmd __attribute__((unused)),
- struct lv_segment *seg __attribute__((unused)),
+ struct lv_segment *seg,
char *params,
uint64_t *total_numerator,
uint64_t *total_denominator)
{
struct dm_status_thin_pool *s;
- percent_t meta_percent;
- percent_t data_percent;
if (!dm_get_status_thin_pool(mem, params, &s))
return_0;
- /*
- * FIXME: how to handle exhaust of metadata space
- * pick the max from data and meta?
- * Support for metadata resize is needed.
- */
- meta_percent = make_percent(s->used_meta_blocks,
- s->total_meta_blocks);
- data_percent = make_percent(s->used_data_blocks,
- s->total_data_blocks);
-
- *percent = data_percent;
- *total_numerator += s->used_data_blocks;
- *total_denominator += s->total_data_blocks;
+ /* With seg report metadata percent, otherwice data percent */
+ if (seg) {
+ *percent = make_percent(s->used_metadata_blocks,
+ s->total_metadata_blocks);
+ *total_numerator += s->used_metadata_blocks;
+ *total_denominator += s->total_metadata_blocks;
+ } else {
+ *percent = make_percent(s->used_data_blocks,
+ s->total_data_blocks);
+ *total_numerator += s->used_data_blocks;
+ *total_denominator += s->total_data_blocks;
+ }
return 1;
}
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 59d11198..851e5784 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -243,10 +243,11 @@ struct dm_pool;
struct dm_status_thin_pool {
uint64_t transaction_id;
- uint64_t used_meta_blocks;
- uint64_t total_meta_blocks;
+ uint64_t used_metadata_blocks;
+ uint64_t total_metadata_blocks;
uint64_t used_data_blocks;
uint64_t total_data_blocks;
+ uint64_t held_metadata_root;
};
int dm_get_status_thin_pool(struct dm_pool *mem, const char *params,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 0b9fb250..88ecfe09 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -3117,10 +3117,11 @@ int dm_get_status_thin_pool(struct dm_pool *mem, const char *params,
return 0;
}
+ /* FIXME: add support for held metadata root */
if (sscanf(params, "%" PRIu64 " %" PRIu64 "/%" PRIu64 " %" PRIu64 "/%" PRIu64,
&s->transaction_id,
- &s->used_meta_blocks,
- &s->total_meta_blocks,
+ &s->used_metadata_blocks,
+ &s->total_metadata_blocks,
&s->used_data_blocks,
&s->total_data_blocks) != 5) {
log_error("Failed to parse thin pool params: %s.", params);