mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: workarounds reported raid status info
Current existing kernels reports status sometimes in weird form. Instead of showing what is the exact progress, we need to estimate this in-sync state from several surrounding states. Main reason here is to never report 100% sync state for a raid device which will be undergoing i.e. recovery.
This commit is contained in:
parent
40e0dcf70d
commit
529dcaf6a3
@ -1,5 +1,6 @@
|
||||
Version 1.02.141 -
|
||||
===============================
|
||||
dm_get_status_raid() handle better some incosistent md statuses.
|
||||
Accept truncated files in calls to dm_stats_update_regions_from_fd().
|
||||
Restore Warning by 5% increment when thin-pool is over 80% (1.02.138).
|
||||
|
||||
|
@ -99,6 +99,7 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params,
|
||||
unsigned num_fields;
|
||||
const char *p, *pp, *msg_fields = "";
|
||||
struct dm_status_raid *s = NULL;
|
||||
unsigned a = 0;
|
||||
|
||||
if ((num_fields = _count_fields(params)) < 4)
|
||||
goto_bad;
|
||||
@ -168,6 +169,23 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params,
|
||||
out:
|
||||
*status = s;
|
||||
|
||||
if (s->insync_regions == s->total_regions) {
|
||||
/* FIXME: kernel gives misleading info here
|
||||
* Trying to recognize a true state */
|
||||
while (i-- > 0)
|
||||
if (s->dev_health[i] == 'a')
|
||||
a++; /* Count number of 'a' */
|
||||
|
||||
if (a && a < s->dev_count) {
|
||||
/* SOME legs are in 'a' */
|
||||
if (!strcasecmp(s->sync_action, "recover")
|
||||
|| !strcasecmp(s->sync_action, "idle"))
|
||||
/* Kernel may possibly start some action
|
||||
* in near-by future, do not report 100% */
|
||||
s->insync_regions--;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
bad:
|
||||
|
Loading…
Reference in New Issue
Block a user