state->fails = 0;
}
+ /*
+ * Trigger action when threshold boundary is exceeded.
+ * Report 80% threshold warning when it's used above 80%.
+ * Only 100% is exception as it cannot be surpased so policy
+ * action is called for: >50%, >55% ... >95%, 100%
+ */
state->metadata_percent = dm_make_percent(tps->used_metadata_blocks, tps->total_metadata_blocks);
if (state->metadata_percent <= WARNING_THRESH)
state->metadata_warn_once = 0; /* Dropped bellow threshold, reset warn once */
else if (!state->metadata_warn_once++) /* Warn once when raised above threshold */
log_warn("WARNING: Thin pool %s metadata is now %.2f%% full.",
device, dm_percent_to_float(state->metadata_percent));
- if (state->metadata_percent >= state->metadata_percent_check) {
- /*
- * Usage has raised more than CHECK_STEP since the last
- * time. Run actions.
- */
- state->metadata_percent_check = (state->metadata_percent / CHECK_STEP) * CHECK_STEP + CHECK_STEP;
-
- needs_policy = 1;
- }
+ if (state->metadata_percent > CHECK_MINIMUM) {
+ /* Run action when usage raised more than CHECK_STEP since the last time */
+ if (state->metadata_percent > state->metadata_percent_check)
+ needs_policy = 1;
+ state->metadata_percent_check = (state->metadata_percent / CHECK_STEP + 1) * CHECK_STEP;
+ if (state->metadata_percent_check == DM_PERCENT_100)
+ state->metadata_percent_check--; /* Can't get bigger then 100% */
+ } else
+ state->metadata_percent_check = CHECK_MINIMUM;
state->data_percent = dm_make_percent(tps->used_data_blocks, tps->total_data_blocks);
if (state->data_percent <= WARNING_THRESH)
else if (!state->data_warn_once++)
log_warn("WARNING: Thin pool %s data is now %.2f%% full.",
device, dm_percent_to_float(state->data_percent));
- if (state->data_percent >= state->data_percent_check) {
- /*
- * Usage has raised more than CHECK_STEP since
- * the last time. Run actions.
- */
- state->data_percent_check = (state->data_percent / CHECK_STEP) * CHECK_STEP + CHECK_STEP;
-
- needs_policy = 1;
- }
+ if (state->data_percent > CHECK_MINIMUM) {
+ /* Run action when usage raised more than CHECK_STEP since the last time */
+ if (state->data_percent > state->data_percent_check)
+ needs_policy = 1;
+ state->data_percent_check = (state->data_percent / CHECK_STEP + 1) * CHECK_STEP;
+ if (state->data_percent_check == DM_PERCENT_100)
+ state->data_percent_check--; /* Can't get bigger then 100% */
+ } else
+ state->data_percent_check = CHECK_MINIMUM;
/* Reduce number of _use_policy() calls by power-of-2 factor till frequency of MAX_FAILS is reached.
* Avoids too high number of error retries, yet shows some status messages in log regularly.
_init_thread_signals(state);
}
- state->metadata_percent_check = CHECK_MINIMUM;
- state->data_percent_check = CHECK_MINIMUM;
state->pid = -1;
*user = state;