1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

cleanup: more use of lvseg_name

Use existing function lvseg_name().
This commit is contained in:
Zdenek Kabelac 2016-12-25 00:29:30 +01:00
parent dc5bb12956
commit 1f5dde38a7
7 changed files with 7 additions and 16 deletions

View File

@ -1940,7 +1940,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
/* FIXME specify events */
if (!monitor_fn(seg, 0)) {
log_error("%s: %s segment monitoring function failed.",
display_lvname(lv), seg->segtype->name);
display_lvname(lv), lvseg_name(seg));
return 0;
}
} else

View File

@ -2493,7 +2493,7 @@ static int _add_target_to_dtree(struct dev_manager *dm,
if (!seg->segtype->ops->add_target_line) {
log_error(INTERNAL_ERROR "_emit_target cannot handle "
"segment type %s.", seg->segtype->name);
"segment type %s.", lvseg_name(seg));
return 0;
}

View File

@ -398,7 +398,7 @@ int export_extents(struct disk_list *dl, uint32_t lv_num,
if (!(seg->segtype->flags & SEG_FORMAT1_SUPPORT)) {
log_error("Segment type %s in LV %s: "
"unsupported by format1",
seg->segtype->name, lv->name);
lvseg_name(seg), lv->name);
return 0;
}
if (seg_type(seg, s) != AREA_PV) {

View File

@ -326,7 +326,7 @@ int validate_lv_cache_create_origin(const struct logical_volume *origin_lv)
lv_is_cow(origin_lv) || lv_is_merging_cow(origin_lv) ||
lv_is_virtual(origin_lv)) {
log_error("Cache is not supported with %s segment type of the original logical volume %s.",
first_seg(origin_lv)->segtype->name, display_lvname(origin_lv));
lvseg_name(first_seg(origin_lv)), display_lvname(origin_lv));
return 0;
}

View File

@ -4596,7 +4596,7 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
if (!policy_amount) {
log_error("Can't extend %s with %s autoextend percent set to 0%%.",
display_lvname(lv), first_seg(lv)->segtype->name);
display_lvname(lv), lvseg_name(first_seg(lv)));
return 0;
}

View File

@ -2724,15 +2724,6 @@ static const char *_get_segtype_alias(const struct segment_type *segtype)
return "";
}
/* Return "linear" for striped segtype with 1 area instead of "striped" */
static const char *_get_segtype_name(const struct segment_type *segtype, unsigned new_image_count)
{
if (!segtype || (segtype_is_striped(segtype) && new_image_count == 1))
return "linear";
return segtype->name;
}
static int _log_possible_conversion_types(const struct logical_volume *lv, const struct segment_type *new_segtype)
{
unsigned possible_conversions = 0;
@ -2753,7 +2744,7 @@ static int _log_possible_conversion_types(const struct logical_volume *lv, const
log_error("Converting %s from %s%s%s%s is "
"directly possible to the following layout%s:",
display_lvname(lv), _get_segtype_name(seg->segtype, seg->area_count),
display_lvname(lv), lvseg_name(seg),
*alias ? " (same as " : "", alias, *alias ? ")" : "",
possible_conversions > 1 ? "s" : "");

View File

@ -431,7 +431,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
/* Separate mirror log or metadata devices so we can clear them */
if (!detach_metadata_devices(seg, &device_list)) {
log_error("Failed to clear %s %s for %s.",
seg->segtype->name, seg_is_raid(seg) ?
lvseg_name(seg), seg_is_raid(seg) ?
"metadata area" : "mirror log", display_lvname(lv));
return 0;
}