master - cleanup: use find_lv_in_vg_by_lvid
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a1213401393ac6e6a9a9e168379574469eb715c8 Commit: a1213401393ac6e6a9a9e168379574469eb715c8 Parent: a8aee7dba2b76409d1630edc4f76021b50b08792 Author: Zdenek Kabelac <[email protected]> AuthorDate: Sun Sep 21 11:46:34 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Sep 24 10:54:47 2014 +0200
cleanup: use find_lv_in_vg_by_lvid
Replace another loop with existion function.
TODO: consider using hash maps for lvname & lvid lookups.
--- lib/metadata/metadata.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
lib/metadata/metadata.c +6 -6
@@ -4818,11 +4818,11 @@ const struct logical_volume *lv_ondisk(const struct logical_volume *lv) vg = lv->vg->vg_ondisk; - dm_list_iterate_items(lvl, &vg->lvs) -if (!strncmp (lvl->lv->lvid.s, lv->lvid.s,sizeof (lv->lvid))) -return lvl->lv; +if (!(lvl =find_lv_in_vg_by_lvid (vg, &lv->lvid))) { +log_error (INTERNAL_ERROR "LV %s (UUID %s) not found in ondisk metadata." , +display_lvname (lv), lv->lvid.s); +return NULL ; + } -log_error (INTERNAL_ERROR "LV %s/%s (UUID %s) not found in ondisk metadata." , - lv->vg->name, lv->name, lv->lvid.s); -return NULL ; +return lvl->lv; }