mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lv_is_visible()
This commit is contained in:
parent
d79e9d0d61
commit
ace652e673
@ -1,7 +1,7 @@
|
|||||||
Version 2.02.03 -
|
Version 2.02.03 -
|
||||||
===================================
|
===================================
|
||||||
Update extent size information in vgchange and vgcreate man pages.
|
Update extent size information in vgchange and vgcreate man pages.
|
||||||
Introduce origin_from_cow().
|
Introduce origin_from_cow() and lv_is_visible().
|
||||||
pvremove without -f now fails if there's no PV label.
|
pvremove without -f now fails if there's no PV label.
|
||||||
Support lvconvert -s.
|
Support lvconvert -s.
|
||||||
Suppress locking library load failure message if --ignorelockingfailure.
|
Suppress locking library load failure message if --ignorelockingfailure.
|
||||||
|
@ -535,6 +535,7 @@ int lv_split_segment(struct logical_volume *lv, uint32_t le);
|
|||||||
*/
|
*/
|
||||||
int lv_is_origin(const struct logical_volume *lv);
|
int lv_is_origin(const struct logical_volume *lv);
|
||||||
int lv_is_cow(const struct logical_volume *lv);
|
int lv_is_cow(const struct logical_volume *lv);
|
||||||
|
int lv_is_visible(const struct logical_volume *lv);
|
||||||
|
|
||||||
int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv);
|
int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv);
|
||||||
|
|
||||||
|
@ -28,6 +28,14 @@ int lv_is_cow(const struct logical_volume *lv)
|
|||||||
return lv->snapshot ? 1 : 0;
|
return lv->snapshot ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lv_is_visible(const struct logical_volume *lv)
|
||||||
|
{
|
||||||
|
if (lv_is_cow(lv))
|
||||||
|
return lv_is_visible(find_cow(lv)->lv);
|
||||||
|
|
||||||
|
return lv->status & VISIBLE_LV ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Given a cow LV, return the snapshot lv_segment that uses it */
|
/* Given a cow LV, return the snapshot lv_segment that uses it */
|
||||||
struct lv_segment *find_cow(const struct logical_volume *lv)
|
struct lv_segment *find_cow(const struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
|
@ -525,8 +525,7 @@ static int _lvname_disp(struct report_handle *rh, struct field *field,
|
|||||||
char *repstr;
|
char *repstr;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
/* FIXME Remove need for snapshot special case */
|
if (lv_is_visible(lv)) {
|
||||||
if (lv->status & VISIBLE_LV || lv_is_cow(lv)) {
|
|
||||||
repstr = lv->name;
|
repstr = lv->name;
|
||||||
return _string_disp(rh, field, &repstr);
|
return _string_disp(rh, field, &repstr);
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv,
|
static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
void *handle)
|
void *handle)
|
||||||
{
|
{
|
||||||
if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
|
if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
|
||||||
!(lv_is_cow(lv)))
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
|
|
||||||
if (arg_count(cmd, colon_ARG))
|
if (arg_count(cmd, colon_ARG))
|
||||||
|
@ -27,9 +27,7 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
|
|
||||||
const char *active_str, *snapshot_str;
|
const char *active_str, *snapshot_str;
|
||||||
|
|
||||||
/* FIXME Avoid snapshot special-case */
|
if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
|
||||||
if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
|
|
||||||
!(lv_is_cow(lv)))
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
|
|
||||||
inkernel = lv_info(cmd, lv, &info, 1) && info.exists;
|
inkernel = lv_info(cmd, lv, &info, 1) && info.exists;
|
||||||
|
@ -35,9 +35,7 @@ static int _vgs_single(struct cmd_context *cmd, const char *vg_name,
|
|||||||
static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
|
static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
void *handle)
|
void *handle)
|
||||||
{
|
{
|
||||||
/* FIXME Avoid snapshot special-case */
|
if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
|
||||||
if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
|
|
||||||
!(lv_is_cow(lv)))
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
|
|
||||||
if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL))
|
if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL))
|
||||||
@ -83,9 +81,7 @@ static int _pvsegs_sub_single(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv,
|
static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
void *handle)
|
void *handle)
|
||||||
{
|
{
|
||||||
/* FIXME Avoid snapshot special-case */
|
if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
|
||||||
if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
|
|
||||||
!(lv_is_cow(lv)))
|
|
||||||
return ECMD_PROCESSED;
|
return ECMD_PROCESSED;
|
||||||
|
|
||||||
return process_each_segment_in_lv(cmd, lv, handle, _segs_single);
|
return process_each_segment_in_lv(cmd, lv, handle, _segs_single);
|
||||||
|
Loading…
Reference in New Issue
Block a user