1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

raid: preload splitted LV only when active

Check splitted leg is active before preload.
(Since splitmirrors currently only does work active raid volumes
it's not a change for current code flow).

Minor optimization included - when already positively checked
for raid image don't check again for raid metadata.
This commit is contained in:
Zdenek Kabelac 2015-01-28 18:30:08 +01:00
parent c3bb6d77dd
commit bfeabea631

View File

@ -1760,18 +1760,15 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
struct detached_lv_data *detached = data; struct detached_lv_data *detached = data;
struct lv_list *lvl_pre; struct lv_list *lvl_pre;
/* Check and preload removed raid image leg */ /* Check and preload removed raid image leg or metadata */
if (lv_is_raid_image(lv)) { if (lv_is_raid_image(lv)) {
if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) && if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
!lv_is_raid_image(lvl_pre->lv) && !lv_is_raid_image(lvl_pre->lv) && lv_is_active(lv) &&
!_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required)) !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
return_0; return_0;
} } else if (lv_is_raid_metadata(lv)) {
/* Check and preload removed of raid metadata */
if (lv_is_raid_metadata(lv)) {
if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) && if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
!lv_is_raid_metadata(lvl_pre->lv) && !lv_is_raid_metadata(lvl_pre->lv) && lv_is_active(lv) &&
!_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required)) !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
return_0; return_0;
} }