All of lore.kernel.org
 help / color / mirror / Atom feed
From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib metadata/lv.c metadata/lv.h report/pr ...
Date: 12 Oct 2010 16:12:19 -0000	[thread overview]
Message-ID: <20101012161219.23977.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski at sourceware.org	2010-10-12 16:12:18

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

Log message:
	Refactor and add code for (lv) 'convert_lv' get function.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
	Reviewed-By: Petr Rockai <prockai@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135

--- LVM2/lib/metadata/lv.c	2010/10/12 16:12:02	1.9
+++ LVM2/lib/metadata/lv.c	2010/10/12 16:12:18	1.10
@@ -18,6 +18,21 @@
 #include "activate.h"
 #include "toolcontext.h"
 
+char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
+{
+	struct lv_segment *seg;
+
+	if (lv->status & (CONVERTING|MIRRORED)) {
+		seg = first_seg(lv);
+
+		/* Temporary mirror is always area_num == 0 */
+		if (seg_type(seg, 0) == AREA_LV &&
+		    is_temporary_mirror_layer(seg_lv(seg, 0)))
+			return dm_pool_strdup(mem, seg_lv(seg, 0)->name);
+	}
+	return NULL;
+}
+
 char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
 {
 	struct lv_segment *seg;
--- LVM2/lib/metadata/lv.h	2010/10/12 16:12:02	1.8
+++ LVM2/lib/metadata/lv.h	2010/10/12 16:12:18	1.9
@@ -55,5 +55,6 @@
 char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
 uint64_t lv_origin_size(const struct logical_volume *lv);
 char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv);
+char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
 
 #endif
--- LVM2/lib/report/properties.c	2010/10/12 16:12:02	1.12
+++ LVM2/lib/report/properties.c	2010/10/12 16:12:18	1.13
@@ -131,7 +131,7 @@
 #define _copy_percent_set _not_implemented_set
 GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
 #define _move_pv_set _not_implemented_set
-#define _convert_lv_get _not_implemented_get
+GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv))
 #define _convert_lv_set _not_implemented_set
 GET_LV_STR_PROPERTY_FN(lv_tags, lv_tags_dup(lv))
 #define _lv_tags_set _not_implemented_set
--- LVM2/lib/report/report.c	2010/10/12 16:12:02	1.134
+++ LVM2/lib/report/report.c	2010/10/12 16:12:18	1.135
@@ -392,19 +392,8 @@
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
 	const char *name = NULL;
-	struct lv_segment *seg;
-
-	if (lv->status & CONVERTING) {
-		if (lv->status & MIRRORED) {
-			seg = first_seg(lv);
-
-			/* Temporary mirror is always area_num == 0 */
-			if (seg_type(seg, 0) == AREA_LV &&
-			    is_temporary_mirror_layer(seg_lv(seg, 0)))
-				name = seg_lv(seg, 0)->name;
-		}
-	}
 
+	name = lv_convert_lv_dup(mem, lv);
 	if (name)
 		return dm_report_field_string(rh, field, &name);
 



             reply	other threads:[~2010-10-12 16:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 16:12 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-11-17 20:08 LVM2/lib metadata/lv.c metadata/lv.h report/pr mornfall
2010-10-21 14:49 wysochanski
2010-10-21 14:49 wysochanski
2010-10-21 14:49 wysochanski
2010-10-12 16:13 wysochanski
2010-10-12 16:12 wysochanski
2010-10-12 16:12 wysochanski
2010-10-13  8:22 ` Zdenek Kabelac
2010-10-12 16:12 wysochanski
2010-10-12 16:11 wysochanski
2010-10-12 16:11 wysochanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101012161219.23977.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.