mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
lvmcache: add mode debug prints
Decorate NULL returns with debug_cache output so the debug log doesn't contain spurios <bactrace> line without any reason for it. Add internal errors when cache is misused.
This commit is contained in:
parent
21b3c983fd
commit
599a05f658
20
lib/cache/lvmcache.c
vendored
20
lib/cache/lvmcache.c
vendored
@ -429,11 +429,15 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgname(const char *vgname, const ch
|
|||||||
if (!vgname)
|
if (!vgname)
|
||||||
return lvmcache_vginfo_from_vgid(vgid);
|
return lvmcache_vginfo_from_vgid(vgid);
|
||||||
|
|
||||||
if (!_vgname_hash)
|
if (!_vgname_hash) {
|
||||||
|
log_debug_cache(INTERNAL_ERROR "Internal cache is no yet initialized.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(vginfo = dm_hash_lookup(_vgname_hash, vgname)))
|
if (!(vginfo = dm_hash_lookup(_vgname_hash, vgname))) {
|
||||||
|
log_debug_cache("Metadata cache has no info for vgname: \"%s\"", vgname);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (vgid)
|
if (vgid)
|
||||||
do
|
do
|
||||||
@ -441,6 +445,10 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgname(const char *vgname, const ch
|
|||||||
return vginfo;
|
return vginfo;
|
||||||
while ((vginfo = vginfo->next));
|
while ((vginfo = vginfo->next));
|
||||||
|
|
||||||
|
if (!vginfo)
|
||||||
|
log_debug_cache("Metadata cache has not found vgname \"%s\" with vgid \"%s\"",
|
||||||
|
vgname, vgid);
|
||||||
|
|
||||||
return vginfo;
|
return vginfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,15 +522,19 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgid(const char *vgid)
|
|||||||
struct lvmcache_vginfo *vginfo;
|
struct lvmcache_vginfo *vginfo;
|
||||||
char id[ID_LEN + 1] __attribute__((aligned(8)));
|
char id[ID_LEN + 1] __attribute__((aligned(8)));
|
||||||
|
|
||||||
if (!_vgid_hash || !vgid)
|
if (!_vgid_hash || !vgid) {
|
||||||
|
log_debug_cache(INTERNAL_ERROR "Internal cache cannot lookup vgid.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* vgid not necessarily NULL-terminated */
|
/* vgid not necessarily NULL-terminated */
|
||||||
strncpy(&id[0], vgid, ID_LEN);
|
strncpy(&id[0], vgid, ID_LEN);
|
||||||
id[ID_LEN] = '\0';
|
id[ID_LEN] = '\0';
|
||||||
|
|
||||||
if (!(vginfo = dm_hash_lookup(_vgid_hash, id)))
|
if (!(vginfo = dm_hash_lookup(_vgid_hash, id))) {
|
||||||
|
log_debug_cache("Metadata cache has no info for vgid \"%s\"", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return vginfo;
|
return vginfo;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user