mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
thin: report external origin
Use the field 'origin' for reporting external origin lv name. For thin volumes with external origin, report the size of external origin size via: lvs -o+origin_size
This commit is contained in:
parent
386f3d5a5e
commit
30c13eff37
@ -594,6 +594,9 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
if (seg->origin)
|
||||
log_print("LV Thin origin name %s",
|
||||
seg->origin->name);
|
||||
if (seg->external_lv)
|
||||
log_print("LV External origin name %s",
|
||||
seg->origin->name);
|
||||
if (inkernel)
|
||||
thin_active = lv_thin_percent(lv, 0, &thin_percent);
|
||||
} else if (lv_is_thin_pool(lv)) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -169,6 +169,9 @@ char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
if (lv_is_thin_volume(lv) && first_seg(lv)->origin)
|
||||
return lv_name_dup(mem, first_seg(lv)->origin);
|
||||
|
||||
if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv)
|
||||
return lv_name_dup(mem, first_seg(lv)->external_lv);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -282,6 +285,8 @@ uint64_t lv_origin_size(const struct logical_volume *lv)
|
||||
{
|
||||
if (lv_is_cow(lv))
|
||||
return (uint64_t) find_cow(lv)->len * lv->vg->extent_size;
|
||||
if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv)
|
||||
return first_seg(lv)->external_lv->size;
|
||||
if (lv_is_origin(lv))
|
||||
return lv->size;
|
||||
return 0;
|
||||
|
@ -343,6 +343,9 @@ static int _origin_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
if (lv_is_thin_volume(lv) && first_seg(lv)->origin)
|
||||
return _lvname_disp(rh, mem, field, first_seg(lv)->origin, private);
|
||||
|
||||
if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv)
|
||||
return _lvname_disp(rh, mem, field, first_seg(lv)->external_lv, private);
|
||||
|
||||
dm_report_field_set_value(field, "", NULL);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user