]> sourceware.org Git - lvm2.git/commitdiff
metadata: use lv_hash in segment-specific metadata parsing main master 1447913946
authorDavid Teigland <teigland@redhat.com>
Tue, 10 Sep 2024 16:51:15 +0000 (11:51 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 10 Sep 2024 16:51:15 +0000 (11:51 -0500)
The lv_hash wasn't being passed to the seg-specific text import
functions, so they were doing many find_lv() calls which consumes
a lot of time when there are many LVs in the metadata.

12 files changed:
lib/cache_segtype/cache.c
lib/format_text/import_vsn1.c
lib/integrity/integrity.c
lib/metadata/segtype.h
lib/mirror/mirrored.c
lib/raid/raid.c
lib/snapshot/snapshot.c
lib/striped/striped.c
lib/thin/thin.c
lib/unknown/unknown.c
lib/vdo/vdo.c
lib/writecache/writecache.c

index 027d5cda15bb210fb67456ae5fe3a0dfb8801f0c..036f8d6f8d0193068b8906ce4e200134bdeb5f0d 100644 (file)
@@ -203,7 +203,8 @@ static int _settings_text_export(const struct lv_segment *seg,
 
 static int _cache_pool_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
 
 static int _cache_pool_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
-                                  struct dm_hash_table *pv_hash __attribute__((unused)))
+                                  struct dm_hash_table *pv_hash __attribute__((unused)),
+                                  struct dm_hash_table *lv_hash)
 {
        struct logical_volume *data_lv, *meta_lv;
        const char *str = NULL;
 {
        struct logical_volume *data_lv, *meta_lv;
        const char *str = NULL;
@@ -212,7 +213,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
                return SEG_LOG_ERROR("Cache data not specified in");
        if (!(str = dm_config_find_str(sn, "data", NULL)))
                return SEG_LOG_ERROR("Cache data must be a string in");
                return SEG_LOG_ERROR("Cache data not specified in");
        if (!(str = dm_config_find_str(sn, "data", NULL)))
                return SEG_LOG_ERROR("Cache data must be a string in");
-       if (!(data_lv = find_lv(seg->lv->vg, str)))
+       if (!(data_lv = dm_hash_lookup(lv_hash, str)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache data in", str);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache data in", str);
 
@@ -220,7 +221,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
                return SEG_LOG_ERROR("Cache metadata not specified in");
        if (!(str = dm_config_find_str(sn, "metadata", NULL)))
                return SEG_LOG_ERROR("Cache metadata must be a string in");
                return SEG_LOG_ERROR("Cache metadata not specified in");
        if (!(str = dm_config_find_str(sn, "metadata", NULL)))
                return SEG_LOG_ERROR("Cache metadata must be a string in");
-       if (!(meta_lv = find_lv(seg->lv->vg, str)))
+       if (!(meta_lv = dm_hash_lookup(lv_hash, str)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache metadata in", str);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache metadata in", str);
 
@@ -439,7 +440,8 @@ static const struct segtype_handler _cache_pool_ops = {
 
 static int _cache_text_import(struct lv_segment *seg,
                              const struct dm_config_node *sn,
 
 static int _cache_text_import(struct lv_segment *seg,
                              const struct dm_config_node *sn,
-                             struct dm_hash_table *pv_hash __attribute__((unused)))
+                             struct dm_hash_table *pv_hash __attribute__((unused)),
+                             struct dm_hash_table *lv_hash)
 {
        struct logical_volume *pool_lv, *origin_lv;
        const char *name;
 {
        struct logical_volume *pool_lv, *origin_lv;
        const char *name;
@@ -449,7 +451,7 @@ static int _cache_text_import(struct lv_segment *seg,
                return SEG_LOG_ERROR("cache_pool not specified in");
        if (!(name = dm_config_find_str(sn, "cache_pool", NULL)))
                return SEG_LOG_ERROR("cache_pool must be a string in");
                return SEG_LOG_ERROR("cache_pool not specified in");
        if (!(name = dm_config_find_str(sn, "cache_pool", NULL)))
                return SEG_LOG_ERROR("cache_pool must be a string in");
-       if (!(pool_lv = find_lv(seg->lv->vg, name)))
+       if (!(pool_lv = dm_hash_lookup(lv_hash, name)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache_pool in", name);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache_pool in", name);
 
@@ -457,7 +459,7 @@ static int _cache_text_import(struct lv_segment *seg,
                return SEG_LOG_ERROR("Cache origin not specified in");
        if (!(name = dm_config_find_str(sn, "origin", NULL)))
                return SEG_LOG_ERROR("Cache origin must be a string in");
                return SEG_LOG_ERROR("Cache origin not specified in");
        if (!(name = dm_config_find_str(sn, "origin", NULL)))
                return SEG_LOG_ERROR("Cache origin must be a string in");
-       if (!(origin_lv = find_lv(seg->lv->vg, name)))
+       if (!(origin_lv = dm_hash_lookup(lv_hash, name)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache origin in", name);
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "cache origin in", name);
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
index 94dabf453c692fc7d360a6bf0efae148e8834905..c713bd2e331f2faf7281ec8b0a3f220c6b6b6083 100644 (file)
@@ -376,7 +376,8 @@ static int _read_segment(struct cmd_context *cmd,
                         struct format_instance *fid,
                         struct dm_pool *mem,
                         struct logical_volume *lv, const struct dm_config_node *sn,
                         struct format_instance *fid,
                         struct dm_pool *mem,
                         struct logical_volume *lv, const struct dm_config_node *sn,
-                        struct dm_hash_table *pv_hash)
+                        struct dm_hash_table *pv_hash,
+                        struct dm_hash_table *lv_hash)
 {
        uint32_t area_count = 0u;
        struct lv_segment *seg;
 {
        uint32_t area_count = 0u;
        struct lv_segment *seg;
@@ -449,7 +450,7 @@ static int _read_segment(struct cmd_context *cmd,
        }
 
        if (seg->segtype->ops->text_import &&
        }
 
        if (seg->segtype->ops->text_import &&
-           !seg->segtype->ops->text_import(seg, sn_child, pv_hash))
+           !seg->segtype->ops->text_import(seg, sn_child, pv_hash, lv_hash))
                return_0;
 
        /* Optional tags */
                return_0;
 
        /* Optional tags */
@@ -551,7 +552,8 @@ static int _read_segments(struct cmd_context *cmd,
                          struct format_instance *fid,
                          struct dm_pool *mem,
                          struct logical_volume *lv, const struct dm_config_node *lvn,
                          struct format_instance *fid,
                          struct dm_pool *mem,
                          struct logical_volume *lv, const struct dm_config_node *lvn,
-                         struct dm_hash_table *pv_hash)
+                         struct dm_hash_table *pv_hash,
+                         struct dm_hash_table *lv_hash)
 {
        const struct dm_config_node *sn;
        int count = 0, seg_count;
 {
        const struct dm_config_node *sn;
        int count = 0, seg_count;
@@ -562,7 +564,7 @@ static int _read_segments(struct cmd_context *cmd,
                 * All sub-sections are assumed to be segments.
                 */
                if (!sn->v) {
                 * All sub-sections are assumed to be segments.
                 */
                if (!sn->v) {
-                       if (!_read_segment(cmd, fmt, fid, mem, lv, sn, pv_hash))
+                       if (!_read_segment(cmd, fmt, fid, mem, lv, sn, pv_hash, lv_hash))
                                return_0;
 
                        count++;
                                return_0;
 
                        count++;
@@ -979,7 +981,7 @@ static int _read_lvsegs(struct cmd_context *cmd,
 
        memcpy(&lv->lvid.id[0], &lv->vg->id, sizeof(lv->lvid.id[0]));
 
 
        memcpy(&lv->lvid.id[0], &lv->vg->id, sizeof(lv->lvid.id[0]));
 
-       if (!_read_segments(cmd, fmt, fid, mem, lv, lvn, pv_hash))
+       if (!_read_segments(cmd, fmt, fid, mem, lv, lvn, pv_hash, lv_hash))
                return_0;
 
        lv->size = (uint64_t) lv->le_count * (uint64_t) vg->extent_size;
                return_0;
 
        lv->size = (uint64_t) lv->le_count * (uint64_t) vg->extent_size;
index b630f8e09d2989685a7e8de1e8674f647291e91d..f9adace894e88bbe4b10e229a5b3ea5ac03be387 100644 (file)
@@ -37,7 +37,8 @@ static void _integrity_display(const struct lv_segment *seg)
 
 static int _integrity_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
 
 static int _integrity_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
-                                  struct dm_hash_table *pv_hash __attribute__((unused)))
+                                  struct dm_hash_table *pv_hash __attribute__((unused)),
+                                  struct dm_hash_table *lv_hash)
 {
        struct integrity_settings *set;
        struct logical_volume *origin_lv = NULL;
 {
        struct integrity_settings *set;
        struct logical_volume *origin_lv = NULL;
@@ -58,7 +59,7 @@ static int _integrity_text_import(struct lv_segment *seg,
        if (!dm_config_get_str(sn, "origin", &origin_name))
                return SEG_LOG_ERROR("origin must be a string in");
 
        if (!dm_config_get_str(sn, "origin", &origin_name))
                return SEG_LOG_ERROR("origin must be a string in");
 
-       if (!(origin_lv = find_lv(seg->lv->vg, origin_name)))
+       if (!(origin_lv = dm_hash_lookup(lv_hash, origin_name)))
                return SEG_LOG_ERROR("Unknown LV specified for integrity origin %s in", origin_name);
 
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
                return SEG_LOG_ERROR("Unknown LV specified for integrity origin %s in", origin_name);
 
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
@@ -103,7 +104,7 @@ static int _integrity_text_import(struct lv_segment *seg,
                if (!dm_config_get_str(sn, "meta_dev", &meta_dev))
                        return SEG_LOG_ERROR("meta_dev must be a string in");
 
                if (!dm_config_get_str(sn, "meta_dev", &meta_dev))
                        return SEG_LOG_ERROR("meta_dev must be a string in");
 
-               if (!(meta_lv = find_lv(seg->lv->vg, meta_dev)))
+               if (!(meta_lv = dm_hash_lookup(lv_hash, meta_dev)))
                        return SEG_LOG_ERROR("Unknown logical volume %s specified for integrity in", meta_dev);
        }
 
                        return SEG_LOG_ERROR("Unknown logical volume %s specified for integrity in", meta_dev);
        }
 
index 4a1fdb8e45dedd2e5bfbbb52f9bbf077ac344819..69a80eec3cd21b7b476b823231aecaf97b4c62bb 100644 (file)
@@ -255,7 +255,8 @@ struct segtype_handler {
                                       uint32_t *area_count);
        int (*text_import) (struct lv_segment * seg,
                            const struct dm_config_node * sn,
                                       uint32_t *area_count);
        int (*text_import) (struct lv_segment * seg,
                            const struct dm_config_node * sn,
-                           struct dm_hash_table * pv_hash);
+                           struct dm_hash_table * pv_hash,
+                           struct dm_hash_table * lv_hash);
        int (*merge_segments) (struct lv_segment * seg1,
                               struct lv_segment * seg2);
        int (*add_target_line) (struct dev_manager *dm, struct dm_pool *mem,
        int (*merge_segments) (struct lv_segment * seg1,
                               struct lv_segment * seg2);
        int (*add_target_line) (struct dev_manager *dm, struct dm_pool *mem,
index f6f815bf4bf8eab6fed13e3c5c14745b194b6d74..072e17b3c7bee85dda98e78e6656620a20a45856 100644 (file)
@@ -74,7 +74,8 @@ static int _mirrored_text_import_area_count(const struct dm_config_node *sn, uin
 }
 
 static int _mirrored_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 }
 
 static int _mirrored_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
-                       struct dm_hash_table *pv_hash)
+                       struct dm_hash_table *pv_hash,
+                       struct dm_hash_table *lv_hash)
 {
        const struct dm_config_value *cv;
        const char *logname = NULL;
 {
        const struct dm_config_value *cv;
        const char *logname = NULL;
@@ -102,7 +103,7 @@ static int _mirrored_text_import(struct lv_segment *seg, const struct dm_config_
        }
 
        if (dm_config_get_str(sn, "mirror_log", &logname)) {
        }
 
        if (dm_config_get_str(sn, "mirror_log", &logname)) {
-               if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
+               if (!(seg->log_lv = dm_hash_lookup(lv_hash, logname))) {
                        log_error("Unrecognised mirror log in "
                                  "segment %s of logical volume %s.",
                                  dm_config_parent_name(sn), seg->lv->name);
                        log_error("Unrecognised mirror log in "
                                  "segment %s of logical volume %s.",
                                  dm_config_parent_name(sn), seg->lv->name);
index 64ef4de78ed74327c5849e670a7769b4ede414ae..f01124925bd04337a6ec3c8600ed0dfde32049ae 100644 (file)
@@ -70,7 +70,8 @@ static int _raid_text_import_area_count(const struct dm_config_node *sn,
 
 static int _raid_text_import_areas(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
 
 static int _raid_text_import_areas(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
-                                  const struct dm_config_value *cv)
+                                  const struct dm_config_value *cv,
+                                  struct dm_hash_table *lv_hash)
 {
        unsigned int s;
        struct logical_volume *lv;
 {
        unsigned int s;
        struct logical_volume *lv;
@@ -88,7 +89,7 @@ static int _raid_text_import_areas(struct lv_segment *seg,
                }
 
                /* Metadata device comes first. */
                }
 
                /* Metadata device comes first. */
-               if (!(lv = find_lv(seg->lv->vg, cv->v.str))) {
+               if (!(lv = dm_hash_lookup(lv_hash, cv->v.str))) {
                        log_error("Couldn't find volume '%s' for segment '%s'.",
                                  cv->v.str ? : "NULL", seg_name);
                        return 0;
                        log_error("Couldn't find volume '%s' for segment '%s'.",
                                  cv->v.str ? : "NULL", seg_name);
                        return 0;
@@ -106,7 +107,7 @@ static int _raid_text_import_areas(struct lv_segment *seg,
                }
 
                /* Data device comes second */
                }
 
                /* Data device comes second */
-               if (!(lv = find_lv(seg->lv->vg, cv->v.str))) {
+               if (!(lv = dm_hash_lookup(lv_hash, cv->v.str))) {
                        log_error("Couldn't find volume '%s' for segment '%s'.",
                                  cv->v.str ? : "NULL", seg_name);
                        return 0;
                        log_error("Couldn't find volume '%s' for segment '%s'.",
                                  cv->v.str ? : "NULL", seg_name);
                        return 0;
@@ -129,7 +130,8 @@ static int _raid_text_import_areas(struct lv_segment *seg,
 
 static int _raid_text_import(struct lv_segment *seg,
                             const struct dm_config_node *sn,
 
 static int _raid_text_import(struct lv_segment *seg,
                             const struct dm_config_node *sn,
-                            struct dm_hash_table *pv_hash)
+                            struct dm_hash_table *pv_hash,
+                            struct dm_hash_table *lv_hash)
 {
        const struct dm_config_value *cv;
        const struct {
 {
        const struct dm_config_value *cv;
        const struct {
@@ -171,7 +173,7 @@ static int _raid_text_import(struct lv_segment *seg,
                return 0;
        }
 
                return 0;
        }
 
-       if (!_raid_text_import_areas(seg, sn, cv)) {
+       if (!_raid_text_import_areas(seg, sn, cv, lv_hash)) {
                log_error("Failed to import RAID component pairs.");
                return 0;
        }
                log_error("Failed to import RAID component pairs.");
                return 0;
        }
index 0ec5320c59a707c1c91baca27c4623335568d8aa..455528e1eb7f004be3814025c7166736f1a7a706 100644 (file)
@@ -36,7 +36,8 @@ static const char *_snap_target_name(const struct lv_segment *seg,
 }
 
 static int _snap_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 }
 
 static int _snap_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
-                       struct dm_hash_table *pv_hash __attribute__((unused)))
+                       struct dm_hash_table *pv_hash __attribute__((unused)),
+                       struct dm_hash_table *lv_hash)
 {
        uint32_t chunk_size;
        struct logical_volume *org, *cow;
 {
        uint32_t chunk_size;
        struct logical_volume *org, *cow;
@@ -71,11 +72,11 @@ static int _snap_text_import(struct lv_segment *seg, const struct dm_config_node
        if (!(org_name = dm_config_find_str(sn, "origin", NULL)))
                return SEG_LOG_ERROR("Snapshot origin must be a string in");
 
        if (!(org_name = dm_config_find_str(sn, "origin", NULL)))
                return SEG_LOG_ERROR("Snapshot origin must be a string in");
 
-       if (!(cow = find_lv(seg->lv->vg, cow_name)))
+       if (!(cow = dm_hash_lookup(lv_hash, cow_name)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "snapshot cow store in", cow_name);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                                     "snapshot cow store in", cow_name);
 
-       if (!(org = find_lv(seg->lv->vg, org_name)))
+       if (!(org = dm_hash_lookup(lv_hash, org_name)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                          "snapshot origin in", org_name);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for "
                          "snapshot origin in", org_name);
 
index 1ff1ebdad69dd53b2902268c161885f4739c4a17..ec4bc961d2094728619f0592fe9258820e8f429d 100644 (file)
@@ -70,7 +70,8 @@ static int _striped_text_import_area_count(const struct dm_config_node *sn, uint
 }
 
 static int _striped_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 }
 
 static int _striped_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
-                       struct dm_hash_table *pv_hash)
+                       struct dm_hash_table *pv_hash,
+                       struct dm_hash_table *lv_hash)
 {
        const struct dm_config_value *cv;
 
 {
        const struct dm_config_value *cv;
 
index ae382dc9de557e2831c0b09679623efd185bf587..0fbcfe9b209657514bf9669b2d5967a73bfff03d 100644 (file)
@@ -53,7 +53,8 @@ static void _thin_pool_display(const struct lv_segment *seg)
 
 static int _thin_pool_add_message(struct lv_segment *seg,
                                  const char *key,
 
 static int _thin_pool_add_message(struct lv_segment *seg,
                                  const char *key,
-                                 const struct dm_config_node *sn)
+                                 const struct dm_config_node *sn,
+                                 struct dm_hash_table *lv_hash)
 {
        const char *lv_name = NULL;
        struct logical_volume *lv = NULL;
 {
        const char *lv_name = NULL;
        struct logical_volume *lv = NULL;
@@ -62,7 +63,7 @@ static int _thin_pool_add_message(struct lv_segment *seg,
 
        /* Message must have only one from: create, delete */
        if (dm_config_get_str(sn, "create", &lv_name)) {
 
        /* Message must have only one from: create, delete */
        if (dm_config_get_str(sn, "create", &lv_name)) {
-               if (!(lv = find_lv(seg->lv->vg, lv_name)))
+               if (!(lv = dm_hash_lookup(lv_hash, lv_name)))
                        return SEG_LOG_ERROR("Unknown LV %s for create message in",
                                             lv_name);
                /* FIXME: switch to _SNAP later, if the created LV has an origin */
                        return SEG_LOG_ERROR("Unknown LV %s for create message in",
                                             lv_name);
                /* FIXME: switch to _SNAP later, if the created LV has an origin */
@@ -80,7 +81,8 @@ static int _thin_pool_add_message(struct lv_segment *seg,
 
 static int _thin_pool_text_import(struct lv_segment *seg,
                                  const struct dm_config_node *sn,
 
 static int _thin_pool_text_import(struct lv_segment *seg,
                                  const struct dm_config_node *sn,
-                                 struct dm_hash_table *pv_hash __attribute__((unused)))
+                                 struct dm_hash_table *pv_hash __attribute__((unused)),
+                                 struct dm_hash_table *lv_hash)
 {
        const char *lv_name;
        struct logical_volume *pool_data_lv, *pool_metadata_lv;
 {
        const char *lv_name;
        struct logical_volume *pool_data_lv, *pool_metadata_lv;
@@ -91,13 +93,13 @@ static int _thin_pool_text_import(struct lv_segment *seg,
        if (!dm_config_get_str(sn, "metadata", &lv_name))
                return SEG_LOG_ERROR("Metadata must be a string in");
 
        if (!dm_config_get_str(sn, "metadata", &lv_name))
                return SEG_LOG_ERROR("Metadata must be a string in");
 
-       if (!(pool_metadata_lv = find_lv(seg->lv->vg, lv_name)))
+       if (!(pool_metadata_lv = dm_hash_lookup(lv_hash, lv_name)))
                return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
 
        if (!dm_config_get_str(sn, "pool", &lv_name))
                return SEG_LOG_ERROR("Pool must be a string in");
 
                return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
 
        if (!dm_config_get_str(sn, "pool", &lv_name))
                return SEG_LOG_ERROR("Pool must be a string in");
 
-       if (!(pool_data_lv = find_lv(seg->lv->vg, lv_name)))
+       if (!(pool_data_lv = dm_hash_lookup(lv_hash, lv_name)))
                return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
 
        if (!attach_pool_data_lv(seg, pool_data_lv))
                return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
 
        if (!attach_pool_data_lv(seg, pool_data_lv))
@@ -141,7 +143,7 @@ static int _thin_pool_text_import(struct lv_segment *seg,
 
        /* Read messages */
        for (; sn; sn = sn->sib)
 
        /* Read messages */
        for (; sn; sn = sn->sib)
-               if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child))
+               if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child, lv_hash))
                        return_0;
 
        return 1;
                        return_0;
 
        return 1;
@@ -468,7 +470,8 @@ static void _thin_display(const struct lv_segment *seg)
 
 static int _thin_text_import(struct lv_segment *seg,
                             const struct dm_config_node *sn,
 
 static int _thin_text_import(struct lv_segment *seg,
                             const struct dm_config_node *sn,
-                            struct dm_hash_table *pv_hash __attribute__((unused)))
+                            struct dm_hash_table *pv_hash __attribute__((unused)),
+                            struct dm_hash_table *lv_hash)
 {
        const char *lv_name;
        struct logical_volume *pool_lv, *origin = NULL, *external_lv = NULL, *merge_lv = NULL;
 {
        const char *lv_name;
        struct logical_volume *pool_lv, *origin = NULL, *external_lv = NULL, *merge_lv = NULL;
@@ -477,7 +480,7 @@ static int _thin_text_import(struct lv_segment *seg,
        if (!dm_config_get_str(sn, "thin_pool", &lv_name))
                return SEG_LOG_ERROR("Thin pool must be a string in");
 
        if (!dm_config_get_str(sn, "thin_pool", &lv_name))
                return SEG_LOG_ERROR("Thin pool must be a string in");
 
-       if (!(pool_lv = find_lv(seg->lv->vg, lv_name)))
+       if (!(pool_lv = dm_hash_lookup(lv_hash, lv_name)))
                return SEG_LOG_ERROR("Unknown thin pool %s in", lv_name);
 
        if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
                return SEG_LOG_ERROR("Unknown thin pool %s in", lv_name);
 
        if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
@@ -487,14 +490,14 @@ static int _thin_text_import(struct lv_segment *seg,
                if (!dm_config_get_str(sn, "origin", &lv_name))
                        return SEG_LOG_ERROR("Origin must be a string in");
 
                if (!dm_config_get_str(sn, "origin", &lv_name))
                        return SEG_LOG_ERROR("Origin must be a string in");
 
-               if (!(origin = find_lv(seg->lv->vg, lv_name)))
+               if (!(origin = dm_hash_lookup(lv_hash, lv_name)))
                        return SEG_LOG_ERROR("Unknown origin %s in", lv_name);
        }
 
        if (dm_config_has_node(sn, "merge")) {
                if (!dm_config_get_str(sn, "merge", &lv_name))
                        return SEG_LOG_ERROR("Merge lv must be a string in");
                        return SEG_LOG_ERROR("Unknown origin %s in", lv_name);
        }
 
        if (dm_config_has_node(sn, "merge")) {
                if (!dm_config_get_str(sn, "merge", &lv_name))
                        return SEG_LOG_ERROR("Merge lv must be a string in");
-               if (!(merge_lv = find_lv(seg->lv->vg, lv_name)))
+               if (!(merge_lv = dm_hash_lookup(lv_hash, lv_name)))
                        return SEG_LOG_ERROR("Unknown merge lv %s in", lv_name);
        }
 
                        return SEG_LOG_ERROR("Unknown merge lv %s in", lv_name);
        }
 
@@ -509,7 +512,7 @@ static int _thin_text_import(struct lv_segment *seg,
                if (!dm_config_get_str(sn, "external_origin", &lv_name))
                        return SEG_LOG_ERROR("External origin must be a string in");
 
                if (!dm_config_get_str(sn, "external_origin", &lv_name))
                        return SEG_LOG_ERROR("External origin must be a string in");
 
-               if (!(external_lv = find_lv(seg->lv->vg, lv_name)))
+               if (!(external_lv = dm_hash_lookup(lv_hash, lv_name)))
                        return SEG_LOG_ERROR("Unknown external origin %s in", lv_name);
        }
 
                        return SEG_LOG_ERROR("Unknown external origin %s in", lv_name);
        }
 
index 51aaebba5808b0545cbc09593487a4802a5d2132..cc625d4e29c2c25cb18df2fee021a571b005a9d9 100644 (file)
@@ -20,7 +20,8 @@
 #include "lib/config/config.h"
 
 static int _unknown_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
 #include "lib/config/config.h"
 
 static int _unknown_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
-                               struct dm_hash_table *pv_hash)
+                               struct dm_hash_table *pv_hash,
+                               struct dm_hash_table *lv_hash)
 {
        struct dm_config_node *new, *last = NULL, *head = NULL;
        const struct dm_config_node *current;
 {
        struct dm_config_node *new, *last = NULL, *head = NULL;
        const struct dm_config_node *current;
index 3a5abacd58cdb64a8a5726a6ae632b13f396609b..a609e4426395d737c03e04e28195b84c886132f4 100644 (file)
@@ -75,7 +75,8 @@ static void _vdo_display(const struct lv_segment *seg)
 
 static int _vdo_text_import(struct lv_segment *seg,
                            const struct dm_config_node *n,
 
 static int _vdo_text_import(struct lv_segment *seg,
                            const struct dm_config_node *n,
-                           struct dm_hash_table *pv_hash __attribute__((unused)))
+                           struct dm_hash_table *pv_hash __attribute__((unused)),
+                           struct dm_hash_table *lv_hash)
 {
        struct logical_volume *vdo_pool_lv;
        const char *str;
 {
        struct logical_volume *vdo_pool_lv;
        const char *str;
@@ -84,7 +85,7 @@ static int _vdo_text_import(struct lv_segment *seg,
        if (!dm_config_has_node(n, "vdo_pool") ||
            !(str = dm_config_find_str(n, "vdo_pool", NULL)))
                return _bad_field("vdo_pool");
        if (!dm_config_has_node(n, "vdo_pool") ||
            !(str = dm_config_find_str(n, "vdo_pool", NULL)))
                return _bad_field("vdo_pool");
-       if (!(vdo_pool_lv = find_lv(seg->lv->vg, str))) {
+       if (!(vdo_pool_lv = dm_hash_lookup(lv_hash, str))) {
                log_error("Unknown VDO pool logical volume %s.", str);
                return 0;
        }
                log_error("Unknown VDO pool logical volume %s.", str);
                return 0;
        }
@@ -205,7 +206,8 @@ static int _vdo_pool_text_import_area_count(const struct dm_config_node *sn __at
 
 static int _vdo_pool_text_import(struct lv_segment *seg,
                                 const struct dm_config_node *n,
 
 static int _vdo_pool_text_import(struct lv_segment *seg,
                                 const struct dm_config_node *n,
-                                struct dm_hash_table *pv_hash __attribute__((unused)))
+                                struct dm_hash_table *pv_hash __attribute__((unused)),
+                                struct dm_hash_table *lv_hash)
 {
        struct dm_vdo_target_params *vtp = &seg->vdo_params;
        struct logical_volume *data_lv;
 {
        struct dm_vdo_target_params *vtp = &seg->vdo_params;
        struct logical_volume *data_lv;
@@ -214,7 +216,7 @@ static int _vdo_pool_text_import(struct lv_segment *seg,
        if (!dm_config_has_node(n, "data") ||
            !(str = dm_config_find_str(n, "data", NULL)))
                return _bad_field("data");
        if (!dm_config_has_node(n, "data") ||
            !(str = dm_config_find_str(n, "data", NULL)))
                return _bad_field("data");
-       if (!(data_lv = find_lv(seg->lv->vg, str))) {
+       if (!(data_lv = dm_hash_lookup(lv_hash, str))) {
                log_error("Unknown logical volume %s.", str);
                return 0;
        }
                log_error("Unknown logical volume %s.", str);
                return 0;
        }
index 4d56317f5da4033b8ec8184df9081cc0df7dd436..c5604a7a4f5772302122f27e64f64cfa3fd1c48f 100644 (file)
@@ -40,7 +40,8 @@ static void _writecache_display(const struct lv_segment *seg)
 
 static int _writecache_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
 
 static int _writecache_text_import(struct lv_segment *seg,
                                   const struct dm_config_node *sn,
-                                  struct dm_hash_table *pv_hash __attribute__((unused)))
+                                  struct dm_hash_table *pv_hash __attribute__((unused)),
+                                  struct dm_hash_table *lv_hash)
 {
        struct logical_volume *origin_lv = NULL;
        struct logical_volume *fast_lv;
 {
        struct logical_volume *origin_lv = NULL;
        struct logical_volume *fast_lv;
@@ -53,7 +54,7 @@ static int _writecache_text_import(struct lv_segment *seg,
        if (!dm_config_get_str(sn, "origin", &origin_name))
                return SEG_LOG_ERROR("origin must be a string in");
 
        if (!dm_config_get_str(sn, "origin", &origin_name))
                return SEG_LOG_ERROR("origin must be a string in");
 
-       if (!(origin_lv = find_lv(seg->lv->vg, origin_name)))
+       if (!(origin_lv = dm_hash_lookup(lv_hash, origin_name)))
                return SEG_LOG_ERROR("Unknown LV specified for writecache origin %s in", origin_name);
 
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
                return SEG_LOG_ERROR("Unknown LV specified for writecache origin %s in", origin_name);
 
        if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
@@ -65,7 +66,7 @@ static int _writecache_text_import(struct lv_segment *seg,
        if (!dm_config_get_str(sn, "writecache", &fast_name))
                return SEG_LOG_ERROR("writecache must be a string in");
 
        if (!dm_config_get_str(sn, "writecache", &fast_name))
                return SEG_LOG_ERROR("writecache must be a string in");
 
-       if (!(fast_lv = find_lv(seg->lv->vg, fast_name)))
+       if (!(fast_lv = dm_hash_lookup(lv_hash, fast_name)))
                return SEG_LOG_ERROR("Unknown logical volume %s specified for writecache in",
                                     fast_name);
 
                return SEG_LOG_ERROR("Unknown logical volume %s specified for writecache in",
                                     fast_name);
 
This page took 0.058222 seconds and 5 git commands to generate.