1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-19 14:04:17 +03:00

commands: error and zero segtype handling

Add function to work with error and zero LVs more easily.
This commit is contained in:
Zdenek Kabelac 2023-07-04 13:26:57 +02:00
parent 226429058c
commit 5175e87fda
2 changed files with 11 additions and 4 deletions

View File

@ -46,6 +46,9 @@ lvp(is_thick_snapshot_LVP, "lv_is_thick_snapshot", NULL)
lvp(is_thin_origin_LVP, "lv_is_thin_origin", NULL) lvp(is_thin_origin_LVP, "lv_is_thin_origin", NULL)
lvp(is_thin_snapshot_LVP, "lv_is_thin_snapshot", NULL) lvp(is_thin_snapshot_LVP, "lv_is_thin_snapshot", NULL)
lvp(is_error_LVP, "lv_is_error", NULL)
lvp(is_zero_LVP, "lv_is_zero", NULL)
lvp(is_cache_origin_LVP, "lv_is_cache_origin", NULL) lvp(is_cache_origin_LVP, "lv_is_cache_origin", NULL)
lvp(is_cow_LVP, "lv_is_cow", NULL) lvp(is_cow_LVP, "lv_is_cow", NULL)
lvp(is_merging_cow_LVP, "lv_is_merging_cow", NULL) lvp(is_merging_cow_LVP, "lv_is_merging_cow", NULL)

View File

@ -2752,6 +2752,10 @@ static int _lv_is_prop(struct cmd_context *cmd, struct logical_volume *lv, int l
return lv_is_cow_covering_origin(lv); return lv_is_cow_covering_origin(lv);
case is_visible_LVP: case is_visible_LVP:
return lv_is_visible(lv); return lv_is_visible(lv);
case is_error_LVP:
return lv_is_error(lv);
case is_zero_LVP:
return lv_is_zero(lv);
case is_historical_LVP: case is_historical_LVP:
return lv_is_historical(lv); return lv_is_historical(lv);
case is_raid_with_tracking_LVP: case is_raid_with_tracking_LVP:
@ -2815,9 +2819,9 @@ static int _lv_is_type(struct cmd_context *cmd, struct logical_volume *lv, int l
case integrity_LVT: case integrity_LVT:
return seg_is_integrity(seg); return seg_is_integrity(seg);
case error_LVT: case error_LVT:
return !strcmp(seg->segtype->name, SEG_TYPE_NAME_ERROR); return seg_is_error(seg);
case zero_LVT: case zero_LVT:
return !strcmp(seg->segtype->name, SEG_TYPE_NAME_ZERO); return seg_is_zero(seg);
default: default:
log_error(INTERNAL_ERROR "unknown lv type value lvt_enum %d", lvt_enum); log_error(INTERNAL_ERROR "unknown lv type value lvt_enum %d", lvt_enum);
} }
@ -2875,9 +2879,9 @@ int get_lvt_enum(struct logical_volume *lv)
if (seg_is_integrity(seg)) if (seg_is_integrity(seg))
return integrity_LVT; return integrity_LVT;
if (!strcmp(seg->segtype->name, SEG_TYPE_NAME_ERROR)) if (seg_is_error(seg))
return error_LVT; return error_LVT;
if (!strcmp(seg->segtype->name, SEG_TYPE_NAME_ZERO)) if (seg_is_zero(seg))
return zero_LVT; return zero_LVT;
return 0; return 0;