public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/metadata/lv.c lib/metadat ...
@ 2011-09-08 20:55 agk
  0 siblings, 0 replies; 2+ messages in thread
From: agk @ 2011-09-08 20:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-09-08 20:55:39

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv.c metadata-exported.h 
	man            : lvs.8.in 

Log message:
	Add 7th lv_attr char to show the related kernel target.
	Add thin volume types to lv_attr.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2100&r2=1.2101
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.209&r2=1.210
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvs.8.in.diff?cvsroot=lvm2&r1=1.13&r2=1.14

--- LVM2/WHATS_NEW	2011/09/07 13:42:00	1.2100
+++ LVM2/WHATS_NEW	2011/09/08 20:55:39	1.2101
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add 7th lv_attr char to show the related kernel target.
   Terminate pv_attr field correctly. (2.02.86)
   Fix 'not not' typo in pvcreate man page.
   Improve man page style for fsadm, lvreduce, lvremove, lvrename, lvresize.
--- LVM2/lib/metadata/lv.c	2011/04/12 12:24:29	1.24
+++ LVM2/lib/metadata/lv.c	2011/09/08 20:55:39	1.25
@@ -298,7 +298,7 @@
 	struct lvinfo info;
 	char *repstr;
 
-	if (!(repstr = dm_pool_zalloc(mem, 7))) {
+	if (!(repstr = dm_pool_zalloc(mem, 8))) {
 		log_error("dm_pool_alloc failed");
 		return 0;
 	}
@@ -311,15 +311,22 @@
 		repstr[0] = 'p';
 	else if (lv->status & CONVERTING)
 		repstr[0] = 'c';
-	else if (lv->status & VIRTUAL)
-		repstr[0] = 'v';
-	/* Origin takes precedence over Mirror */
-	else if (lv_is_origin(lv)) {
+	/* Origin takes precedence over mirror and thin volume */
+	else if (lv_is_origin(lv))
 		repstr[0] = (lv_is_merging_origin(lv)) ? 'O' : 'o';
-	}
-	else if (lv->status & MIRRORED) {
+	else if (lv->status & MIRRORED)
 		repstr[0] = (lv->status & LV_NOTSYNCED) ? 'M' : 'm';
-	}else if (lv->status & MIRROR_IMAGE)
+	else if (lv_is_thin_volume(lv))
+		repstr[0] = 'V';
+	else if (lv->status & VIRTUAL)
+		repstr[0] = 'v';
+	else if (lv_is_thin_pool(lv))
+		repstr[0] = 't';
+	else if (lv_is_thin_pool_data(lv))
+		repstr[0] = 'T';
+	else if (lv_is_thin_pool_metadata(lv) || (lv->status & RAID_META))
+		repstr[0] = 'e';
+	else if (lv->status & MIRROR_IMAGE)
 		repstr[0] = (_lv_mimage_in_sync(lv)) ? 'i' : 'I';
 	else if (lv->status & MIRROR_LOG)
 		repstr[0] = 'l';
@@ -370,6 +377,22 @@
 		repstr[4] = '-';
 		repstr[5] = '-';
 	}
+
+	if (lv_is_thin_type(lv))
+		repstr[6] = 't';
+	else if (lv_is_mirror_type(lv))
+		repstr[6] = 'm';
+	else if (lv_is_raid_type(lv))
+		repstr[6] = 'r';
+	else if (lv_is_cow(lv) || lv_is_origin(lv))
+		repstr[6] = 's';
+	else if (lv_has_unknown_segments(lv))
+		repstr[6] = 'u';
+	else if (lv_is_virtual(lv))
+		repstr[6] = 'v';
+	else
+		repstr[6] = '-';
+
 out:
 	return repstr;
 }
--- LVM2/lib/metadata/metadata-exported.h	2011/09/08 16:41:18	1.209
+++ LVM2/lib/metadata/metadata-exported.h	2011/09/08 20:55:39	1.210
@@ -141,6 +141,12 @@
 #define lv_is_mirrored(lv)	((lv)->status & MIRRORED ? 1 : 0)
 #define lv_is_rlog(lv)		((lv)->status & REPLICATOR_LOG ? 1 : 0)
 
+#define lv_is_thin_type(lv)	((lv)->status & (THIN_POOL | THIN_VOLUME | THIN_POOL_DATA | THIN_POOL_METADATA) ? 1 : 0)
+#define lv_is_mirror_type(lv)	((lv)->status & (MIRROR_LOG | MIRROR_IMAGE | MIRRORED | PVMOVE) ? 1 : 0)
+#define lv_is_raid_type(lv)	((lv)->status & (RAID | RAID_IMAGE | RAID_META))
+
+#define lv_is_virtual(lv)	((lv)->status & VIRTUAL)
+
 /* Ordered list - see lv_manip.c */
 typedef enum {
 	AREA_UNASSIGNED,
--- LVM2/man/lvs.8.in	2010/06/23 12:32:08	1.13
+++ LVM2/man/lvs.8.in	2011/09/08 20:55:39	1.14
@@ -70,7 +70,9 @@
 .IP 1 3
 Volume type: (m)irrored, (M)irrored without initial sync, (o)rigin,
 (O)rigin with merging snapshot, (s)napshot, merging (S)napshot, (p)vmove,
-(v)irtual, mirror (i)mage, mirror (I)mage out-of-sync, under (c)onversion
+(v)irtual, mirror (i)mage, mirror (I)mage out-of-sync, mirror (l)og device,
+under (c)onversion, thin (V)olume, (t)hin pool, (T)hin pool data, thin pool 
+m(e)tadata
 .IP 2 3
 Permissions: (w)riteable, (r)ead-only
 .IP 3 3
@@ -84,6 +86,14 @@
 mapped (d)evice present without tables, mapped device present with (i)nactive table
 .IP 6 3
 device (o)pen
+.IP 7 3
+Target type: (m)irror, (r)aid, (s)napshot, (t)hin, (u)nknown, (v)irtual.  
+This groups logical volumes related to the same kernel target together.  So,
+for example, mirror images, mirror logs as well as mirrors themselves appear as
+(m) if they use the original device-mapper mirror kernel driver; whereas the raid
+equivalents using the md raid kernel driver all appear as (r).
+Snapshots using the original device-mapper driver appear as (s); whereas
+snapshots of thin volumes using the new thin provisioning driver appear as (t).
 .RE
 .TP
 .I \-\-segments


^ permalink raw reply	[flat|nested] 2+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv.c lib/metadat ...
@ 2011-03-05 12:14 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2011-03-05 12:14 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-03-05 12:14:00

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv.c lv.h 
	lib/report     : properties.c report.c 

Log message:
	Fix reading of released memory
	
	lvseg_segtype_dup used memory pool vg memory pool for strind duplication.
	However this one gets released before reporting happens so the command like:
	
	pvs -o segtype
	
	prints data from already released memory pool. Thanks to the fact there
	is not much allocation happing after the VG is released, the memory
	stays unmodified and correct result is printed.
	
	Fix adds support for mempool passed parameter (like other similar
	query commands) and uses dm_report memory pool for string duplication.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1934&r2=1.1935
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.h.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.142&r2=1.143

--- LVM2/WHATS_NEW	2011/03/02 23:38:22	1.1934
+++ LVM2/WHATS_NEW	2011/03/05 12:14:00	1.1935
@@ -1,5 +1,6 @@
 Version 2.02.85 - 
 ===================================
+  Fix reading of released memory for printing segment type.
   Fix syslog initialisation in clvmd to respect lvm.conf setting.
   Fix possible overflow in maximum stripe size and physical extent size.
   Add test for failed allocation from dm_task_set_uuid() in dmeventd.
--- LVM2/lib/metadata/lv.c	2010/11/30 11:53:32	1.20
+++ LVM2/lib/metadata/lv.c	2011/03/05 12:14:00	1.21
@@ -26,13 +26,13 @@
 	return tags_format_and_copy(seg->lv->vg->vgmem, &seg->tags);
 }
 
-char *lvseg_segtype_dup(const struct lv_segment *seg)
+char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg)
 {
 	if (seg->area_count == 1) {
 		return (char *)"linear";
 	}
 
-	return dm_pool_strdup(seg->lv->vg->vgmem, seg->segtype->ops->name(seg));
+	return dm_pool_strdup(mem, seg->segtype->ops->name(seg));
 }
 
 uint64_t lvseg_chunksize(const struct lv_segment *seg)
--- LVM2/lib/metadata/lv.h	2011/02/18 14:47:30	1.18
+++ LVM2/lib/metadata/lv.h	2011/03/05 12:14:00	1.19
@@ -66,7 +66,7 @@
 uint64_t lvseg_start(const struct lv_segment *seg);
 uint64_t lvseg_size(const struct lv_segment *seg);
 uint64_t lvseg_chunksize(const struct lv_segment *seg);
-char *lvseg_segtype_dup(const struct lv_segment *seg);
+char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg);
 char *lvseg_tags_dup(const struct lv_segment *seg);
 
 #endif /* _LVM_LV_H */
--- LVM2/lib/report/properties.c	2011/02/18 14:47:30	1.29
+++ LVM2/lib/report/properties.c	2011/03/05 12:14:00	1.30
@@ -225,7 +225,7 @@
 SET_VG_NUM_PROPERTY_FN(vg_mda_copies, vg_set_mda_copies)
 
 /* LVSEG */
-GET_LVSEG_STR_PROPERTY_FN(segtype, lvseg_segtype_dup(lvseg))
+GET_LVSEG_STR_PROPERTY_FN(segtype, lvseg_segtype_dup(lvseg->lv->vg->vgmem, lvseg))
 #define _segtype_set _not_implemented_set
 GET_LVSEG_NUM_PROPERTY_FN(stripes, lvseg->area_count)
 #define _stripes_set _not_implemented_set
--- LVM2/lib/report/report.c	2011/02/18 14:47:30	1.142
+++ LVM2/lib/report/report.c	2011/03/05 12:14:00	1.143
@@ -278,9 +278,13 @@
 			 const void *data, void *private __attribute__((unused)))
 {
 	const struct lv_segment *seg = (const struct lv_segment *) data;
-
 	char *name;
-	name = lvseg_segtype_dup(seg);
+
+	if (!(name = lvseg_segtype_dup(mem, seg))) {
+		log_error("Failed to get segtype.");
+		return 0;
+	}
+
 	dm_report_field_set_value(field, name, NULL);
 	return 1;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-08 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08 20:55 LVM2 ./WHATS_NEW lib/metadata/lv.c lib/metadat agk
  -- strict thread matches above, loose matches on Subject: below --
2011-03-05 12:14 zkabelac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).