Index: lib/metadata/metadata.h =================================================================== RCS file: /cvs/lvm2/LVM2/lib/metadata/metadata.h,v retrieving revision 1.138 diff -u -p -r1.138 metadata.h --- lib/metadata/metadata.h 6 Apr 2006 13:39:16 -0000 1.138 +++ lib/metadata/metadata.h 7 Apr 2006 10:29:37 -0000 @@ -535,6 +535,7 @@ int lv_split_segment(struct logical_volu */ int lv_is_origin(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); Index: lib/metadata/snapshot_manip.c =================================================================== RCS file: /cvs/lvm2/LVM2/lib/metadata/snapshot_manip.c,v retrieving revision 1.23 diff -u -p -r1.23 snapshot_manip.c --- lib/metadata/snapshot_manip.c 6 Apr 2006 13:39:16 -0000 1.23 +++ lib/metadata/snapshot_manip.c 7 Apr 2006 10:29:37 -0000 @@ -28,6 +28,14 @@ int lv_is_cow(const struct logical_volum 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 */ struct lv_segment *find_cow(const struct logical_volume *lv) { Index: lib/report/report.c =================================================================== RCS file: /cvs/lvm2/LVM2/lib/report/report.c,v retrieving revision 1.42 diff -u -p -r1.42 report.c --- lib/report/report.c 6 Apr 2006 14:06:27 -0000 1.42 +++ lib/report/report.c 7 Apr 2006 10:29:38 -0000 @@ -525,8 +525,7 @@ static int _lvname_disp(struct report_ha char *repstr; size_t len; - /* FIXME Remove need for snapshot special case */ - if (lv->status & VISIBLE_LV || lv_is_cow(lv)) { + if (lv_is_visible(lv)) { repstr = lv->name; return _string_disp(rh, field, &repstr); } Index: tools/lvdisplay.c =================================================================== RCS file: /cvs/lvm2/LVM2/tools/lvdisplay.c,v retrieving revision 1.17 diff -u -p -r1.17 lvdisplay.c --- tools/lvdisplay.c 23 Nov 2005 16:16:39 -0000 1.17 +++ tools/lvdisplay.c 7 Apr 2006 10:29:38 -0000 @@ -18,8 +18,7 @@ static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) && - !(lv_is_cow(lv))) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; if (arg_count(cmd, colon_ARG)) Index: tools/lvscan.c =================================================================== RCS file: /cvs/lvm2/LVM2/tools/lvscan.c,v retrieving revision 1.30 diff -u -p -r1.30 lvscan.c --- tools/lvscan.c 6 Apr 2006 14:06:27 -0000 1.30 +++ tools/lvscan.c 7 Apr 2006 10:29:38 -0000 @@ -27,9 +27,7 @@ static int lvscan_single(struct cmd_cont const char *active_str, *snapshot_str; - /* FIXME Avoid snapshot special-case */ - if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) && - !(lv_is_cow(lv))) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; inkernel = lv_info(cmd, lv, &info, 1) && info.exists; Index: tools/reporter.c =================================================================== RCS file: /cvs/lvm2/LVM2/tools/reporter.c,v retrieving revision 1.10 diff -u -p -r1.10 reporter.c --- tools/reporter.c 16 Oct 2005 23:03:59 -0000 1.10 +++ tools/reporter.c 7 Apr 2006 10:29:38 -0000 @@ -35,9 +35,7 @@ static int _vgs_single(struct cmd_contex static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - /* FIXME Avoid snapshot special-case */ - if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) && - !(lv_is_cow(lv))) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL)) @@ -83,9 +81,7 @@ static int _pvsegs_sub_single(struct cmd static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - /* FIXME Avoid snapshot special-case */ - if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) && - !(lv_is_cow(lv))) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; return process_each_segment_in_lv(cmd, lv, handle, _segs_single);