mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Index cached vgmetadata by vgid not vgname to cope with duplicate vgnames. (dwyso)
This commit is contained in:
parent
fec1903f58
commit
9b99f3337b
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.45 -
|
Version 2.02.45 -
|
||||||
===================================
|
===================================
|
||||||
|
Index cached vgmetadata by vgid not vgname to cope with duplicate vgnames.
|
||||||
No longer require kernel and metadata major numbers to match.
|
No longer require kernel and metadata major numbers to match.
|
||||||
Add a fully-functional get_cluster_name() to clvmd corosync interface.
|
Add a fully-functional get_cluster_name() to clvmd corosync interface.
|
||||||
Remove duplicate cpg_initialize from clvmd startup.
|
Remove duplicate cpg_initialize from clvmd startup.
|
||||||
|
29
lib/cache/lvmcache.c
vendored
29
lib/cache/lvmcache.c
vendored
@ -71,11 +71,20 @@ static void _free_cached_vgmetadata(struct lvmcache_vginfo *vginfo)
|
|||||||
log_debug("Metadata cache: VG %s wiped.", vginfo->vgname);
|
log_debug("Metadata cache: VG %s wiped.", vginfo->vgname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _store_metadata(struct lvmcache_vginfo *vginfo,
|
/*
|
||||||
struct volume_group *vg, unsigned precommitted)
|
* Cache VG metadata against the vginfo with matching vgid.
|
||||||
|
*/
|
||||||
|
static void _store_metadata(struct volume_group *vg, unsigned precommitted)
|
||||||
{
|
{
|
||||||
|
char uuid[64] __attribute((aligned(8)));
|
||||||
|
struct lvmcache_vginfo *vginfo;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
if (!(vginfo = vginfo_from_vgid((const char *)&vg->id))) {
|
||||||
|
stack;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (vginfo->vgmetadata)
|
if (vginfo->vgmetadata)
|
||||||
_free_cached_vgmetadata(vginfo);
|
_free_cached_vgmetadata(vginfo);
|
||||||
|
|
||||||
@ -86,8 +95,14 @@ static void _store_metadata(struct lvmcache_vginfo *vginfo,
|
|||||||
|
|
||||||
vginfo->precommitted = precommitted;
|
vginfo->precommitted = precommitted;
|
||||||
|
|
||||||
log_debug("Metadata cache: VG %s stored (%d bytes%s).", vginfo->vgname,
|
if (!id_write_format((const struct id *)vginfo->vgid, uuid, sizeof(uuid))) {
|
||||||
size, precommitted ? ", precommitted" : "");
|
stack;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log_debug("Metadata cache: VG %s (%s) stored (%d bytes%s).",
|
||||||
|
vginfo->vgname, uuid, size,
|
||||||
|
precommitted ? ", precommitted" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _update_cache_info_lock_state(struct lvmcache_info *info,
|
static void _update_cache_info_lock_state(struct lvmcache_info *info,
|
||||||
@ -1051,7 +1066,6 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted)
|
|||||||
{
|
{
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
struct lvmcache_info *info;
|
struct lvmcache_info *info;
|
||||||
struct lvmcache_vginfo *vginfo;
|
|
||||||
char pvid_s[ID_LEN + 1] __attribute((aligned(8)));
|
char pvid_s[ID_LEN + 1] __attribute((aligned(8)));
|
||||||
|
|
||||||
pvid_s[sizeof(pvid_s) - 1] = '\0';
|
pvid_s[sizeof(pvid_s) - 1] = '\0';
|
||||||
@ -1067,9 +1081,8 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* store text representation of vg to cache */
|
/* store text representation of vg to cache */
|
||||||
if (vg->cmd->current_settings.cache_vgmetadata &&
|
if (vg->cmd->current_settings.cache_vgmetadata)
|
||||||
(vginfo = vginfo_from_vgname(vg->name, NULL)))
|
_store_metadata(vg, precommitted);
|
||||||
_store_metadata(vginfo, vg, precommitted);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user