diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-01-10 13:13:42 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-01-10 13:13:42 +0000 |
commit | 6feecf76d4ac9477ee3213fe16cf40a1eb35c566 (patch) | |
tree | 7387d99be02f1edb5c79793e7c4ed575f828df79 /lib/cache/lvmcache.c | |
parent | 12fbaae042651eaa7ab74f0b658fbfecc90f2f87 (diff) | |
download | lvm2-6feecf76d4ac9477ee3213fe16cf40a1eb35c566.tar.gz lvm2-6feecf76d4ac9477ee3213fe16cf40a1eb35c566.tar.xz lvm2-6feecf76d4ac9477ee3213fe16cf40a1eb35c566.zip |
Change import_vg_from_buffer to use config_tree
Change function import_vg_from_buffer() to import_vg_from_config_tree().
Instead of creating config tree inside the function allow config tree to
be passed as parameter - usable later for caching.
Diffstat (limited to 'lib/cache/lvmcache.c')
-rw-r--r-- | lib/cache/lvmcache.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index d5455631..ebd6d444 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -26,6 +26,7 @@ #include "format-text.h" #include "format_pool.h" #include "format1.h" +#include "config.h" static struct dm_hash_table *_pvid_hash = NULL; static struct dm_hash_table *_vgid_hash = NULL; @@ -650,12 +651,20 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted) vgid, NULL))) return_NULL; - if (!(vg = import_vg_from_buffer(vginfo->vgmetadata, fid))) { + if (!(vginfo->cft = + create_config_tree_from_string(fid->fmt->cmd, + vginfo->vgmetadata))) { _free_cached_vgmetadata(vginfo); - free_vg(vg); return_NULL; } + if (!(vg = import_vg_from_config_tree(vginfo->cft, fid))) { + _free_cached_vgmetadata(vginfo); + destroy_config_tree(vginfo->cft); + return_NULL; + } + destroy_config_tree(vginfo->cft); + log_debug("Using cached %smetadata for VG %s.", vginfo->precommitted ? "pre-committed" : "", vginfo->vgname); |