1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

debug: use just LV name for debug message

Since we detect 'debug' level after calling 'log_debug()' - all
the arguments are evaluated, so in this case display_lvname() was
preparing a string that is not used in case debugging is not enabled.

So since these string are on 'hot-path' and it's already known
which VG is being worked on, in these few cases just use lv->name.
This commit is contained in:
Zdenek Kabelac 2024-10-20 20:48:56 +02:00
parent ccd693d065
commit c19dfe11a5
3 changed files with 4 additions and 5 deletions

View File

@ -629,7 +629,7 @@ static int _read_lvnames(struct cmd_context *cmd,
if (!(lv->name = dm_pool_strdup(mem, lvn->key)))
return_0;
log_debug_metadata("Importing logical volume %s.", display_lvname(lv));
log_debug_metadata("Importing logical volume %s.", lv->name);
if (!(lvn = lvn->child)) {
log_error("Empty logical volume section for %s.",

View File

@ -868,7 +868,7 @@ int add_seg_to_segs_using_this_lv(struct logical_volume *lv,
}
log_very_verbose("Adding %s:" FMTu32 " as an user of %s.",
display_lvname(seg->lv), seg->le, display_lvname(lv));
seg->lv->name, seg->le, lv->name);
if (!(sl = dm_pool_zalloc(lv->vg->vgmem, sizeof(*sl)))) {
log_error("Failed to allocate segment list.");
@ -1303,8 +1303,7 @@ int set_lv_segment_area_lv(struct lv_segment *seg, uint32_t area_num,
uint64_t status)
{
log_very_verbose("Stack %s:" FMTu32 "[" FMTu32 "] on LV %s:" FMTu32 ".",
display_lvname(seg->lv), seg->le, area_num,
display_lvname(lv), le);
seg->lv->name, seg->le, area_num, lv->name, le);
if (area_num >= seg->area_count) {
log_error(INTERNAL_ERROR "Try to set to high area number (%u >= %u) for LV %s.",

View File

@ -3506,7 +3506,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
if (!process_lv)
continue;
log_very_verbose("Adding %s to the list of LVs to be processed.", display_lvname(lvl->lv));
log_very_verbose("Adding %s to the list of LVs to be processed.", lvl->lv->name);
if (!(final_lvl = dm_pool_zalloc(cmd->mem, sizeof(struct lv_list)))) {
log_error("Failed to allocate final LV list item.");