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

cleanup: easier code for raid plugin

Set bits only when then were not yet assigned.
This commit is contained in:
Zdenek Kabelac 2016-12-09 13:58:19 +01:00
parent 15e4ab3e93
commit f9c6c115d3

View File

@ -38,6 +38,7 @@ static int _process_raid_event(struct dso_state *state, char *params, const char
struct dm_status_raid *status;
const char *d;
int dead = 0, r = 1;
uint32_t dev;
if (!dm_get_status_raid(state->mem, params, &status)) {
log_error("Failed to process status line for %s.", device);
@ -46,24 +47,26 @@ static int _process_raid_event(struct dso_state *state, char *params, const char
d = status->dev_health;
while ((d = strchr(d, 'D'))) {
uint32_t dev = (uint32_t)(d - status->dev_health);
dev = (uint32_t)(d - status->dev_health);
if (!(state->raid_devs[dev / 64] & (UINT64_C(1) << (dev % 64))))
log_error("Device #%u of %s array, %s, has failed.",
dev, status->raid_type, device);
if (!(state->raid_devs[dev / 64] & (UINT64_C(1) << (dev % 64)))) {
state->raid_devs[dev / 64] |= (UINT64_C(1) << (dev % 64));
log_warn("WARNING: Device #%u of %s array, %s, has failed.",
dev, status->raid_type, device);
}
state->raid_devs[dev / 64] |= (UINT64_C(1) << (dev % 64));
d++;
dead = 1;
}
if (dead) {
if (status->insync_regions < status->total_regions) {
if (!state->warned)
if (!state->warned) {
state->warned = 1;
log_warn("WARNING: waiting for resynchronization to finish "
"before initiating repair on RAID device %s.", device);
}
state->warned = 1;
goto out; /* Not yet done syncing with accessible devices */
}