All of lore.kernel.org
 help / color / mirror / Atom feed
* Replicator part for lvm
@ 2009-11-02 14:20 Zdenek Kabelac
  2009-11-02 14:20 ` [PATCH 01/18] Adding fflush after yes/no prompt Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel

Generic code updates:

[PATCH 01/18] Adding fflush after yes/no prompt
[PATCH 02/18] Export outnl and indent functions for modules
[PATCH 03/18] Export outsz() and outhnt() for modules
[PATCH 04/18] Export outfc() macro and out_text_with_comment()
[PATCH 05/18] Use outsz macro

Replicator related code:

[PATCH 06/18] Replicator: add libdm support
[PATCH 07/18] Replicator: suspend/deactivate replicator
[PATCH 08/18] Replicator: add lvm support
[PATCH 09/18] Replicator: vg validation
[PATCH 10/18] Replicator: extend _lv_each_dependency() rep. deps
[PATCH 11/18] Replicator: update _create_partial_dtree()
[PATCH 12/18] Replicator: add replicator to dtree
[PATCH 13/18] Replicator: do not remove of replicators' LVs
[PATCH 14/18] Replicator: activate change for vgchange
[PATCH 15/18] Replicator: add new options for replicator
[PATCH 16/18] Replicator: update copyright dates
[PATCH 17/18] Replicator: new variable in generated file
[PATCH 18/18] Replicator: update of generated configure file

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

* [PATCH 01/18] Adding fflush after yes/no prompt
  2009-11-02 14:20 Replicator part for lvm Zdenek Kabelac
@ 2009-11-02 14:20 ` Zdenek Kabelac
  2009-11-02 14:20   ` [PATCH 02/18] Export outnl and indent functions for modules Zdenek Kabelac
  2009-11-02 14:49   ` [PATCH 01/18] Adding fflush after yes/no prompt Alasdair G Kergon
  0 siblings, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Add fflush in case the log is redirected to buffered file.
It might not be obvious why the application wait on stdin as the
prompt might not be flushed to the file without this patch.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/display/display.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/display/display.c b/lib/display/display.c
index 5277743..a7ca9ec 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -824,6 +824,7 @@ char yes_no_prompt(const char *prompt, ...)
 			va_start(ap, prompt);
 			vprintf(prompt, ap);
 			va_end(ap);
+			fflush(stdout);
 		}
 
 		if ((c = getchar()) == EOF) {
-- 
1.6.5.1

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

* [PATCH 02/18] Export outnl and indent functions for modules
  2009-11-02 14:20 ` [PATCH 01/18] Adding fflush after yes/no prompt Zdenek Kabelac
@ 2009-11-02 14:20   ` Zdenek Kabelac
  2009-11-02 14:20     ` [PATCH 03/18] Export outsz() and outhnt() " Zdenek Kabelac
  2009-11-02 14:50     ` [PATCH 02/18] Export outnl and indent functions " Alasdair G Kergon
  2009-11-02 14:49   ` [PATCH 01/18] Adding fflush after yes/no prompt Alasdair G Kergon
  1 sibling, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Exporting functions out_inc_indent(), out_dec_indent() for creating
indented metadata lines. Macro outnl() is using out_newline()
instead of direct f->fn() that required the visibility of internal
struct formatter.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/format_text/export.c      |   18 ++++++++++++++++++
 lib/format_text/text_export.h |    6 +++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 889992b..7f7d0de 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -235,6 +235,24 @@ static int _sectors_to_units(uint64_t sectors, char *buffer, size_t s)
 	return dm_snprintf(buffer, s, "# %g %s", d, _units[i]) > 0;
 }
 
+/* increment indention level */
+void out_inc_indent(struct formatter *f)
+{
+	_inc_indent(f);
+}
+
+/* decrement indention level */
+void out_dec_indent(struct formatter *f)
+{
+	_dec_indent(f);
+}
+
+/* insert new line */
+int out_newline(struct formatter *f)
+{
+	return f->nl(f);
+}
+
 /*
  * Appends a comment giving a size in more easily
  * readable form (eg, 4M instead of 8096).
diff --git a/lib/format_text/text_export.h b/lib/format_text/text_export.h
index 1cd42a9..cdba82f 100644
--- a/lib/format_text/text_export.h
+++ b/lib/format_text/text_export.h
@@ -17,7 +17,7 @@
 #define _LVM_TEXT_EXPORT_H
 
 #define outf(args...) do {if (!out_text(args)) return_0;} while (0)
-#define outnl(f) do {if (!f->nl(f)) return_0;} while (0)
+#define outnl(f) do {if (!out_newline(f)) return_0;} while (0)
 
 struct formatter;
 struct lv_segment;
@@ -37,4 +37,8 @@ int out_config_node(struct formatter *f, const struct config_node *cn);
 int out_areas(struct formatter *f, const struct lv_segment *seg,
 	      const char *type);
 
+void out_inc_indent(struct formatter *f);
+void out_dec_indent(struct formatter *f);
+int out_newline(struct formatter *f);
+
 #endif
-- 
1.6.5.1

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

* [PATCH 03/18] Export outsz() and outhnt() for modules
  2009-11-02 14:20   ` [PATCH 02/18] Export outnl and indent functions for modules Zdenek Kabelac
@ 2009-11-02 14:20     ` Zdenek Kabelac
  2009-11-02 14:20       ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Zdenek Kabelac
  2009-11-02 14:54       ` [PATCH 03/18] Export outsz() and outhnt() for modules Alasdair G Kergon
  2009-11-02 14:50     ` [PATCH 02/18] Export outnl and indent functions " Alasdair G Kergon
  1 sibling, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Adding macro outsz() for out_size() and outhnt() for out_hint()
that checks for error in a similar way as outf() does for out_text()

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/format_text/export.c      |   23 +++++++++--------------
 lib/format_text/text_export.h |    2 ++
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 7f7d0de..f25b80e 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -386,9 +386,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
 	if (vg->system_id && *vg->system_id)
 		outf(f, "system_id = \"%s\"", vg->system_id);
 
-	if (!out_size(f, (uint64_t) vg->extent_size, "extent_size = %u",
-		      vg->extent_size))
-		return_0;
+	outsz(f, (uint64_t) vg->extent_size, "extent_size = %u",
+	      vg->extent_size);
 	outf(f, "max_lv = %u", vg->max_lv);
 	outf(f, "max_pv = %u", vg->max_pv);
 
@@ -453,9 +452,8 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg)
 			return 0;
 		}
 
-		if (!out_hint(f, "device = \"%s\"",
-			      escape_double_quotes(buf, pv_dev_name(pv))))
-			return_0;
+		outhnt(f, "device = \"%s\"",
+		       escape_double_quotes(buf, pv_dev_name(pv)));
 		outnl(f);
 
 		if (!_print_flag_config(f, pv->status, PV_FLAGS))
@@ -467,13 +465,11 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg)
 			outf(f, "tags = %s", buffer);
 		}
 
-		if (!out_size(f, pv->size, "dev_size = %" PRIu64, pv->size))
-			return_0;
+		outsz(f, pv->size, "dev_size = %" PRIu64, pv->size);
 
 		outf(f, "pe_start = %" PRIu64, pv->pe_start);
-		if (!out_size(f, vg->extent_size * (uint64_t) pv->pe_count,
-			      "pe_count = %u", pv->pe_count))
-			return_0;
+		outsz(f, vg->extent_size * (uint64_t) pv->pe_count,
+		      "pe_count = %u", pv->pe_count);
 
 		_dec_indent(f);
 		outf(f, "}");
@@ -493,9 +489,8 @@ static int _print_segment(struct formatter *f, struct volume_group *vg,
 	_inc_indent(f);
 
 	outf(f, "start_extent = %u", seg->le);
-	if (!out_size(f, (uint64_t) seg->len * vg->extent_size,
-		      "extent_count = %u", seg->len))
-		return_0;
+	outsz(f, (uint64_t) seg->len * vg->extent_size,
+	      "extent_count = %u", seg->len);
 
 	outnl(f);
 	outf(f, "type = \"%s\"", seg->segtype->name);
diff --git a/lib/format_text/text_export.h b/lib/format_text/text_export.h
index cdba82f..a452439 100644
--- a/lib/format_text/text_export.h
+++ b/lib/format_text/text_export.h
@@ -16,6 +16,8 @@
 #ifndef _LVM_TEXT_EXPORT_H
 #define _LVM_TEXT_EXPORT_H
 
+#define outsz(args...) do {if (!out_size(args)) return_0;} while (0)
+#define outhnt(args...) do {if (!out_hint(args)) return_0;} while (0)
 #define outf(args...) do {if (!out_text(args)) return_0;} while (0)
 #define outnl(f) do {if (!out_newline(f)) return_0;} while (0)
 
-- 
1.6.5.1

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

* [PATCH 04/18] Export outfc() macro and out_text_with_comment()
  2009-11-02 14:20     ` [PATCH 03/18] Export outsz() and outhnt() " Zdenek Kabelac
@ 2009-11-02 14:20       ` Zdenek Kabelac
  2009-11-02 14:20         ` [PATCH 05/18] Use outsz macro Zdenek Kabelac
  2009-11-02 14:56         ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Alasdair G Kergon
  2009-11-02 14:54       ` [PATCH 03/18] Export outsz() and outhnt() for modules Alasdair G Kergon
  1 sibling, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Support also commented lines with out_text_with_comment() API call.
It is similar to out_text() function and it takes extra argument
for comment. Macro outfc() is similar to outf().

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/format_text/export.c      |    6 +++---
 lib/format_text/text_export.h |    4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index f25b80e..f683b37 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -286,9 +286,9 @@ int out_hint(struct formatter *f, const char *fmt, ...)
 }
 
 /*
- * Appends a comment
+ * The normal output function with comment
  */
-static int _out_comment(struct formatter *f, const char *comment, const char *fmt, ...)
+int out_text_with_comment(struct formatter *f, const char *comment, const char *fmt, ...)
 {
 	va_list ap;
 	int r;
@@ -579,7 +579,7 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
 
 	switch (lv->read_ahead) {
 	case DM_READ_AHEAD_NONE:
-		_out_comment(f, "# None", "read_ahead = -1");
+		outfc(f, "# None", "read_ahead = -1");
 		break;
 	case DM_READ_AHEAD_AUTO:
 		/* No output - use default */
diff --git a/lib/format_text/text_export.h b/lib/format_text/text_export.h
index a452439..63c8999 100644
--- a/lib/format_text/text_export.h
+++ b/lib/format_text/text_export.h
@@ -18,6 +18,7 @@
 
 #define outsz(args...) do {if (!out_size(args)) return_0;} while (0)
 #define outhnt(args...) do {if (!out_hint(args)) return_0;} while (0)
+#define outfc(args...) do {if (!out_text_with_comment(args)) return_0;} while (0)
 #define outf(args...) do {if (!out_text(args)) return_0;} while (0)
 #define outnl(f) do {if (!out_newline(f)) return_0;} while (0)
 
@@ -39,6 +40,9 @@ int out_config_node(struct formatter *f, const struct config_node *cn);
 int out_areas(struct formatter *f, const struct lv_segment *seg,
 	      const char *type);
 
+int out_text_with_comment(struct formatter *f, const char* comment, const char *fmt, ...)
+    __attribute__ ((format(printf, 3, 4)));
+
 void out_inc_indent(struct formatter *f);
 void out_dec_indent(struct formatter *f);
 int out_newline(struct formatter *f);
-- 
1.6.5.1

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

* [PATCH 05/18] Use outsz macro
  2009-11-02 14:20       ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Zdenek Kabelac
@ 2009-11-02 14:20         ` Zdenek Kabelac
  2009-11-02 14:20           ` [PATCH 06/18] Replicator: add libdm support Zdenek Kabelac
  2009-11-02 14:59           ` [PATCH 05/18] Use outsz macro Alasdair G Kergon
  2009-11-02 14:56         ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Alasdair G Kergon
  1 sibling, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Using outsz() macro instead of direct call of out_size() with check
for error status of this function.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/mirror/mirrored.c |    4 ++--
 lib/striped/striped.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index e93ed0b..dfac91e 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -149,8 +149,8 @@ static int _mirrored_text_export(const struct lv_segment *seg, struct formatter
 {
 	outf(f, "mirror_count = %u", seg->area_count);
 	if (seg->status & PVMOVE)
-		out_size(f, (uint64_t) seg->extents_copied * seg->lv->vg->extent_size,
-			 "extents_moved = %" PRIu32, seg->extents_copied);
+		outsz(f, (uint64_t) seg->extents_copied * seg->lv->vg->extent_size,
+		      "extents_moved = %" PRIu32, seg->extents_copied);
 	if (seg->log_lv)
 		outf(f, "mirror_log = \"%s\"", seg->log_lv->name);
 	if (seg->region_size)
diff --git a/lib/striped/striped.c b/lib/striped/striped.c
index f187da5..220edd8 100644
--- a/lib/striped/striped.c
+++ b/lib/striped/striped.c
@@ -98,8 +98,8 @@ static int _striped_text_export(const struct lv_segment *seg, struct formatter *
 	     (seg->area_count == 1) ? "\t# linear" : "");
 
 	if (seg->area_count > 1)
-		out_size(f, (uint64_t) seg->stripe_size,
-			 "stripe_size = %u", seg->stripe_size);
+		outsz(f, (uint64_t) seg->stripe_size,
+		      "stripe_size = %u", seg->stripe_size);
 
 	return out_areas(f, seg, "stripe");
 }
-- 
1.6.5.1

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

* [PATCH 06/18] Replicator: add libdm support
  2009-11-02 14:20         ` [PATCH 05/18] Use outsz macro Zdenek Kabelac
@ 2009-11-02 14:20           ` Zdenek Kabelac
  2009-11-02 14:20             ` [PATCH 07/18] Replicator: suspend/deactivate replicator Zdenek Kabelac
  2009-11-02 14:59           ` [PATCH 05/18] Use outsz macro Alasdair G Kergon
  1 sibling, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Introducing dm_tree_node_add_replicator_target() and
dm_tree_node_add_replicator_dev_target().

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 libdm/.exported_symbols |    2 +
 libdm/libdevmapper.h    |   27 +++++
 libdm/libdm-deptree.c   |  276 ++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 300 insertions(+), 5 deletions(-)

diff --git a/libdm/.exported_symbols b/libdm/.exported_symbols
index 71f7b86..7b5e3f0 100644
--- a/libdm/.exported_symbols
+++ b/libdm/.exported_symbols
@@ -77,6 +77,8 @@ dm_tree_node_add_crypt_target
 dm_tree_node_add_mirror_target
 dm_tree_node_add_mirror_target_log
 dm_tree_node_add_target_area
+dm_tree_node_add_replicator_target
+dm_tree_node_add_replicator_dev_target
 dm_tree_node_set_read_ahead
 dm_tree_skip_lockfs
 dm_tree_use_no_flush_suspend
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 721e08a..f96aed3 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -430,6 +430,33 @@ int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node,
 					  const char *log_uuid,
 					  unsigned area_count,
 					  uint32_t flags);
+
+int dm_tree_node_add_replicator_target(struct dm_tree_node *node,
+				       uint64_t size,
+				       const char *rlog_uuid,
+				       const char *rlog_type,
+				       unsigned rsite_index,
+				       int async_action,
+/* Replicator async action flags */
+#define DM_REPLICATOR_SYNC	0		/* use synchronous replication */
+#define DM_REPLICATOR_WARN	1		/* warn if replicator is slow */
+#define DM_REPLICATOR_STALL	2		/* stall replicator if not fast enough */
+#define DM_REPLICATOR_DROP	3		/* drop legs */
+#define DM_REPLICATOR_FAIL	4		/* fail replicator if slow */
+				       uint32_t async_timeout,
+				       uint64_t fall_behind_data,
+				       uint32_t fall_behind_ios);
+
+int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
+					   uint64_t size,
+					   const char *replicator_uuid,	/* replicator control device */
+					   uint64_t rdevice_index,
+					   const char *rdev_uuid,	/* rimage device name/uuid */
+					   unsigned rsite_index,
+					   const char *slog_uuid,
+					   uint32_t slog_flags,		/* Mirror log flags */
+					   uint32_t slog_size);
+
 int dm_tree_node_add_target_area(struct dm_tree_node *node,
 				    const char *dev_name,
 				    const char *dlid,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 5af24c3..0ba4e7e 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -33,6 +33,8 @@ enum {
 	SEG_ERROR,
 	SEG_LINEAR,
 	SEG_MIRRORED,
+	SEG_REPLICATOR,
+	SEG_REPLICATOR_DEV,
 	SEG_SNAPSHOT,
 	SEG_SNAPSHOT_ORIGIN,
 	SEG_STRIPED,
@@ -49,6 +51,8 @@ struct {
 	{ SEG_ERROR, "error" },
 	{ SEG_LINEAR, "linear" },
 	{ SEG_MIRRORED, "mirror" },
+	{ SEG_REPLICATOR, "replicator" },
+	{ SEG_REPLICATOR_DEV, "replicator-dev" },
 	{ SEG_SNAPSHOT, "snapshot" },
 	{ SEG_SNAPSHOT_ORIGIN, "snapshot-origin" },
 	{ SEG_STRIPED, "striped" },
@@ -62,6 +66,23 @@ struct seg_area {
 	struct dm_tree_node *dev_node;
 
 	uint64_t offset;
+
+	unsigned rsite_index;		/* Replicator site index */
+	struct dm_tree_node *slog;	/* Replicator sync log node */
+	uint64_t region_size;		/* Replicator sync log size */
+	uint32_t flags;			/* Replicator sync log flags */
+};
+
+/* Replicator-log has a list of sites */
+/* CHECKME: maybe move to seg_area too ?? */
+struct replicator_site {
+	struct dm_list list;
+
+	unsigned rsite_index;
+	int async_action;
+	uint32_t async_timeout;
+	uint32_t fall_behind_ios;
+	uint64_t fall_behind_data;
 };
 
 /* Per-segment properties */
@@ -72,8 +93,8 @@ struct load_segment {
 
 	uint64_t size;
 
-	unsigned area_count;		/* Linear + Striped + Mirrored + Crypt */
-	struct dm_list areas;		/* Linear + Striped + Mirrored + Crypt */
+	unsigned area_count;		/* Linear + Striped + Mirrored + Crypt + Replicator */
+	struct dm_list areas;		/* Linear + Striped + Mirrored + Crypt + Replicator */
 
 	uint32_t stripe_size;		/* Striped */
 
@@ -82,7 +103,7 @@ struct load_segment {
 	struct dm_tree_node *cow;	/* Snapshot */
 	struct dm_tree_node *origin;	/* Snapshot + Snapshot origin */
 
-	struct dm_tree_node *log;	/* Mirror */
+	struct dm_tree_node *log;	/* Mirror + Replicator */
 	uint32_t region_size;		/* Mirror */
 	unsigned clustered;		/* Mirror */
 	unsigned mirror_area_count;	/* Mirror */
@@ -94,6 +115,13 @@ struct load_segment {
 	const char *iv;			/* Crypt */
 	uint64_t iv_offset;		/* Crypt */
 	const char *key;		/* Crypt */
+
+	const char *rlog_type;		/* Replicator */
+	struct dm_list rsites;		/* Replicator */
+	unsigned rsite_count;		/* Replicator */
+	unsigned rdevice_count;		/* Replicator */
+	struct dm_tree_node *replicator;/* Replicator-dev */
+	uint64_t rdevice_index;		/* Replicator-dev */
 };
 
 /* Per-device properties */
@@ -1299,13 +1327,49 @@ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)),
 	struct seg_area *area;
 	char devbuf[DM_FORMAT_DEV_BUFSIZE];
 	unsigned first_time = 1;
+	const char *logtype;
+	unsigned log_parm_count;
 
 	dm_list_iterate_items(area, &seg->areas) {
 		if (!_build_dev_string(devbuf, sizeof(devbuf), area->dev_node))
 			return_0;
 
-		EMIT_PARAMS(*pos, "%s%s %" PRIu64, first_time ? "" : " ",
-			    devbuf, area->offset);
+		switch (seg->type) {
+		case SEG_REPLICATOR_DEV:
+			EMIT_PARAMS(*pos, " %d 1 %s", area->rsite_index, devbuf);
+			if (!first_time) {
+				/* remote devices */
+				log_parm_count = (area->flags & (DM_NOSYNC | DM_FORCESYNC)) ? 2 : 1;
+
+				if (!area->slog) {
+					devbuf[0] = 0;		/* only core log parameters */
+					logtype = "core";
+				} else {
+					devbuf[0] = ' ';	/* extra space before device name */
+					if (!_build_dev_string(devbuf + 1, sizeof(devbuf) - 1,
+							       area->slog))
+						return_0;
+					logtype = "disk";
+					log_parm_count++;	/* extra sync log device name parameter */
+				}
+
+				EMIT_PARAMS(*pos, " %s %u%s %" PRIu64, logtype,
+					    log_parm_count, devbuf, area->region_size);
+
+				logtype = (area->flags & DM_NOSYNC) ?
+					" nosync" : (area->flags & DM_FORCESYNC) ?
+					" sync" : NULL;
+
+                                if (logtype)
+					EMIT_PARAMS(*pos, logtype);
+			} else
+				EMIT_PARAMS(*pos, " nolog 0");
+
+			break;
+		default:
+			EMIT_PARAMS(*pos, "%s%s %" PRIu64, first_time ? "" : " ",
+				    devbuf, area->offset);
+		}
 
 		first_time = 0;
 	}
@@ -1313,6 +1377,42 @@ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)),
 	return 1;
 }
 
+static int _replicator_emit_segment_line(const struct load_segment *seg, char *params,
+					 size_t paramsize, int *pos)
+{
+	const struct load_segment *rlog_seg;
+	const struct replicator_site *rsite;
+	char rlogbuf[DM_FORMAT_DEV_BUFSIZE];
+	unsigned parm_count;
+
+	if (!seg->log || !_build_dev_string(rlogbuf, sizeof(rlogbuf), seg->log))
+		return_0;
+
+	rlog_seg = dm_list_item(dm_list_last(&seg->log->props.segs),
+				struct load_segment);
+
+	EMIT_PARAMS(*pos, "%s 4 %s 0 auto %" PRIu64,
+		    seg->rlog_type, rlogbuf, rlog_seg->size);
+
+	dm_list_iterate_items(rsite, &seg->rsites) {
+		parm_count = (rsite->fall_behind_data
+			      || rsite->fall_behind_ios
+			      || rsite->async_timeout) ? 4 : 2;
+
+		EMIT_PARAMS(*pos, " blockdev %u %u %s", parm_count, rsite->rsite_index,
+			    (rsite->async_action == DM_REPLICATOR_SYNC) ? "sync" : "async");
+
+		if (rsite->fall_behind_data)
+			EMIT_PARAMS(*pos, " data %" PRIu64, rsite->fall_behind_data);
+		else if (rsite->fall_behind_ios)
+			EMIT_PARAMS(*pos, " ios %" PRIu32, rsite->fall_behind_ios);
+		else if (rsite->async_timeout)
+			EMIT_PARAMS(*pos, " timeout %" PRIu32, rsite->async_timeout);
+	}
+
+	return 1;
+}
+
 /*
  * Returns: 1 on success, 0 on failure
  */
@@ -1453,6 +1553,21 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 		if (!r)
 			return_0;
 		break;
+	case SEG_REPLICATOR:
+		if ((r = _replicator_emit_segment_line(seg, params, paramsize,
+						       &pos)) <= 0) {
+			stack;
+			return r;
+		}
+		break;
+	case SEG_REPLICATOR_DEV:
+		if (!seg->replicator || !_build_dev_string(originbuf,
+							   sizeof(originbuf),
+							   seg->replicator))
+			return_0;
+
+		EMIT_PARAMS(pos, "%s %" PRIu64, originbuf, seg->rdevice_index);
+		break;
 	case SEG_SNAPSHOT:
 		if (!_build_dev_string(originbuf, sizeof(originbuf), seg->origin))
 			return_0;
@@ -1480,12 +1595,14 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 
 	switch(seg->type) {
 	case SEG_ERROR:
+	case SEG_REPLICATOR:
 	case SEG_SNAPSHOT:
 	case SEG_SNAPSHOT_ORIGIN:
 	case SEG_ZERO:
 		break;
 	case SEG_CRYPT:
 	case SEG_LINEAR:
+	case SEG_REPLICATOR_DEV:
 	case SEG_STRIPED:
 		if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) {
 			stack;
@@ -1638,6 +1755,9 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
 			}
 		}
 
+		if (child->activation_priority != 0)
+			continue;
+
 		/* Propagate device size change change */
 		if (child->props.size_changed)
 			dnode->props.size_changed = 1;
@@ -1900,6 +2020,152 @@ int dm_tree_node_add_mirror_target(struct dm_tree_node *node,
 	return 1;
 }
 
+int dm_tree_node_add_replicator_target(struct dm_tree_node *node,
+				       uint64_t size,
+				       const char *rlog_uuid,
+				       const char *rlog_type,
+				       unsigned rsite_index,
+				       int async_action,
+				       uint32_t async_timeout,
+				       uint64_t fall_behind_data,
+				       uint32_t fall_behind_ios)
+{
+	struct load_segment *rseg;
+	struct replicator_site *rsite;
+
+	if (rsite_index == 0) {
+		/* local site0 - add replog segment and set rlog device */
+		if (!(rseg = _add_segment(node, SEG_REPLICATOR, size)))
+			return_0;
+
+		if (!(rseg->log = dm_tree_find_node_by_uuid(node->dtree, rlog_uuid))) {
+			log_error("Missing replicator log uuid %s.", rlog_uuid);
+			return 0;
+		}
+
+		if (!_link_tree_nodes(node, rseg->log))
+			return_0;
+
+		if (strcmp(rlog_type, "ringbuffer") != 0) {
+			log_error("Unsupported rlog type %s.", rlog_type);
+			return 0;
+		}
+
+		if (!(rseg->rlog_type = dm_pool_strdup(node->dtree->mem, rlog_type)))
+			return_0;
+
+		dm_list_init(&rseg->rsites);
+		rseg->rdevice_count = 0;
+		node->activation_priority = 1;
+	}
+
+	if (!node->props.segment_count) {
+		log_error("Internal error: Attempt to add remote site area before replog.");
+		return 0;
+	}
+
+	/* new remote site */
+	if (async_action == DM_REPLICATOR_SYNC
+	    && (async_timeout || fall_behind_ios || fall_behind_data)) {
+		log_error("Unsupported combination of sync options passed.");
+		return 0;
+	}
+
+	rseg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment);
+
+	if (!(rsite = dm_pool_zalloc(node->dtree->mem, sizeof (*rsite)))) {
+		log_error("Failed to allocate remote site segment.");
+		return 0;
+	}
+	dm_list_add(&rseg->rsites, &rsite->list);
+	rseg->rsite_count++;
+
+	rsite->async_action = async_action;
+	rsite->async_timeout = async_timeout;
+	rsite->fall_behind_data = fall_behind_data;
+	rsite->fall_behind_ios = fall_behind_ios;
+	rsite->rsite_index = rsite_index;
+
+	return 1;
+}
+
+/* Appends device node to Replicator */
+int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
+					   uint64_t size,
+					   const char *replicator_uuid,
+					   uint64_t rdevice_index,
+					   const char *rdev_uuid,
+					   unsigned rsite_index,
+					   const char *slog_uuid,
+					   uint32_t slog_flags,
+					   uint32_t slog_size)
+{
+	struct seg_area *area;
+	struct load_segment *rseg;
+	int is_uuid = (rdev_uuid) ? (strchr(rdev_uuid, '/') == NULL) : 0;
+
+	if (rsite_index == 0) {
+		/* site index for local target */
+		if (!(rseg = _add_segment(node, SEG_REPLICATOR_DEV, size)))
+			return_0;
+
+		if (!(rseg->replicator = dm_tree_find_node_by_uuid(node->dtree, replicator_uuid))) {
+			log_error("Missing replicator uuid %s.", replicator_uuid);
+			return 0;
+		}
+
+		if (!rseg->replicator->props.segment_count) {
+			/* local slink 0 for replicator must be always initialized first */
+			log_error("Internal error: Attempt to use empty replicator segment.");
+			return 0;
+		}
+
+
+		dm_list_item(dm_list_last(&rseg->replicator->props.segs),
+			     struct load_segment)->rdevice_count++;
+
+		if (!_link_tree_nodes(node, rseg->replicator))
+			return_0;
+
+		rseg->rdevice_index = rdevice_index;
+	} else {
+		if (!node->props.segment_count) {
+			/* local slink 0 for replicator must be always initialized first */
+			log_error("Internal error: Attempt to add incorrrect remote target segment.");
+			return 0;
+		}
+
+		rseg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment);
+	}
+
+	if (!(slog_flags & DM_CORELOG) && !slog_uuid) {
+		log_error("Unspecified sync log uuid.");
+		return 0;
+	}
+
+	if (!dm_tree_node_add_target_area(node, (is_uuid) ? NULL : rdev_uuid,
+					  (is_uuid) ? rdev_uuid :  NULL, 0))
+		return 0;
+
+	area = dm_list_item(dm_list_last(&rseg->areas), struct seg_area);
+
+	if (!(slog_flags & DM_CORELOG)) {
+		if (!(area->slog = dm_tree_find_node_by_uuid(node->dtree, slog_uuid))) {
+			log_error("Couldn't find sync log uuid %s.", slog_uuid);
+			return 0;
+		}
+
+		if (!_link_tree_nodes(node, area->slog))
+			return_0;
+	}
+
+	area->flags = slog_flags;
+	area->region_size = slog_size;
+	area->rsite_index = rsite_index;
+
+	return 1;
+}
+
 static int _add_area(struct dm_tree_node *node, struct load_segment *seg, struct dm_tree_node *dev_node, uint64_t offset)
 {
 	struct seg_area *area;
-- 
1.6.5.1

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

* [PATCH 07/18] Replicator: suspend/deactivate replicator
  2009-11-02 14:20           ` [PATCH 06/18] Replicator: add libdm support Zdenek Kabelac
@ 2009-11-02 14:20             ` Zdenek Kabelac
       [not found]               ` <1257171622-8380-9-git-send-email-zkabelac@redhat.com>
  2009-11-03 16:46               ` [PATCH 07/18] Replicator: suspend/deactivate replicator Mike Snitzer
  0 siblings, 2 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Introducing dm_tree_set_replicator_suspend() to suspend
replicator control device before actual deactivation of replicator-dev
head device.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 libdm/.exported_symbols |    1 +
 libdm/libdevmapper.h    |    2 +
 libdm/libdm-deptree.c   |   63 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/libdm/.exported_symbols b/libdm/.exported_symbols
index 7b5e3f0..3217e03 100644
--- a/libdm/.exported_symbols
+++ b/libdm/.exported_symbols
@@ -79,6 +79,7 @@ dm_tree_node_add_mirror_target_log
 dm_tree_node_add_target_area
 dm_tree_node_add_replicator_target
 dm_tree_node_add_replicator_dev_target
+dm_tree_set_replicator_suspend
 dm_tree_node_set_read_ahead
 dm_tree_skip_lockfs
 dm_tree_use_no_flush_suspend
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index f96aed3..66ce055 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -457,6 +457,8 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
 					   uint32_t slog_flags,		/* Mirror log flags */
 					   uint32_t slog_size);
 
+int dm_tree_set_replicator_suspend(struct dm_tree *dtree, const char *uuid);
+
 int dm_tree_node_add_target_area(struct dm_tree_node *node,
 				    const char *dev_name,
 				    const char *dlid,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 0ba4e7e..652b9e8 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -157,6 +157,7 @@ struct dm_tree_node {
         struct dm_list used_by;    	/* Nodes that use this node */
 
 	int activation_priority;	/* 0 gets activated first */
+	int replicator_suspend;		/* 1 gets suspend first */
 
 	uint16_t udev_flags;		/* Udev control flags */
 
@@ -678,6 +679,18 @@ void dm_tree_node_set_read_ahead(struct dm_tree_node *dnode,
 	dnode->props.read_ahead_flags = read_ahead_flags;
 }
 
+int dm_tree_set_replicator_suspend(struct dm_tree *dtree, const char *uuid)
+{
+	struct dm_tree_node *dnode;
+
+	if ((dnode = dm_tree_find_node_by_uuid(dtree, uuid))) {
+		log_verbose("Setting replicator suspend for %s", dnode->name);
+		dnode->replicator_suspend = 1;
+	}
+
+	return 1;
+}
+
 int dm_tree_add_dev(struct dm_tree *dtree, uint32_t major, uint32_t minor)
 {
 	return _add_dev(dtree, &dtree->root, major, minor) ? 1 : 0;
@@ -1030,6 +1043,53 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor,
 	return r;
 }
 
+static int _suspend_replicator_parent(struct dm_tree_node *dnode,
+				      const char *uuid_prefix,
+				      size_t uuid_prefix_len)
+{
+	struct dm_info info;
+	const struct dm_info *dinfo;
+	const char *name;
+	const char *uuid;
+	struct dm_tree_link *dlink;
+
+	dm_list_iterate_items(dlink, &dnode->uses) {
+		if (!dlink->node->replicator_suspend)
+			continue;
+
+		if (!(uuid = dm_tree_node_get_uuid(dlink->node))) {
+			stack;
+			continue;
+		}
+		/* Ignore if it doesn't belong to this VG */
+		if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
+			continue;
+
+		if (!(dinfo = dm_tree_node_get_info(dlink->node))) {
+			stack;
+			continue;
+		}
+
+		if (dinfo->suspended)
+			continue;
+
+		if (!(name = dm_tree_node_get_name(dlink->node))) {
+			stack;
+			continue;
+		}
+
+		if (!_suspend_node(name, dinfo->major, dinfo->minor,
+				   1, 1, &info)) {
+			log_error("Unable to suspend %s (%" PRIu32
+				  ":%" PRIu32 ")", name, dinfo->major,
+				  dinfo->minor);
+			return 0;
+		}
+	}
+
+	return 1;
+}
+
 int dm_tree_deactivate_children(struct dm_tree_node *dnode,
 				   const char *uuid_prefix,
 				   size_t uuid_prefix_len)
@@ -1066,6 +1126,9 @@ int dm_tree_deactivate_children(struct dm_tree_node *dnode,
 		    !info.exists || info.open_count)
 			continue;
 
+		if (!_suspend_replicator_parent(child, uuid_prefix, uuid_prefix_len))
+			continue;
+
 		if (!_deactivate_node(name, info.major, info.minor,
 				      &dnode->dtree->cookie, dnode->udev_flags)) {
 			log_error("Unable to deactivate %s (%" PRIu32
-- 
1.6.5.1

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

* [PATCH 09/18] Replicator: vg validation
       [not found]               ` <1257171622-8380-9-git-send-email-zkabelac@redhat.com>
@ 2009-11-02 14:20                 ` Zdenek Kabelac
  2009-11-02 14:20                   ` [PATCH 10/18] Replicator: extend _lv_each_dependency() rep. deps Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Validate replicator segments

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/metadata/metadata.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 67ba551..ebb2f16 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2088,6 +2088,67 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
 	}
 }
 
+/*
+ * Check for duplicate
+ *  site name
+ *  site index
+ *  device name
+ *  device index
+ */
+static int _replicator_validate(const struct logical_volume *lv)
+{
+	struct replicator_site *rsite, *rsiteb;
+	struct replicator_device *rdev, *rdevb;
+        int r = 1;
+
+	dm_list_iterate_items(rsite, &lv->rsites) {
+		dm_list_iterate_items(rsiteb, &lv->rsites) {
+			if (rsite == rsiteb)
+				break;
+			if (strcasecmp(rsite->name, rsiteb->name) == 0) {
+				log_error("Internal error: Duplicate site name "
+					  "%s detected for replicator %s",
+					  rsite->name, lv->name);
+                                r = 0;
+			}
+			if (rsite->site_index == rsiteb->site_index) {
+				log_error("Internal error: Duplicate site index "
+					  "%d detected for replicator %s/%s",
+					  rsite->site_index, lv->name, rsite->name);
+				r = 0;
+			}
+		}
+
+		dm_list_iterate_items(rdev, &rsite->rdevices) {
+			dm_list_iterate_items(rdevb, &rsite->rdevices) {
+				if (rdev == rdevb)
+					break;
+				log_error("devs: lv:%s  %s", rdev->name, rdevb->name);
+				if (rdev->slog && (rdev->slog == rdevb->slog)) {
+					log_error("Internal error: Duplicate sync log "
+						  "%s detected for replicator %s",
+						  rdev->slog->name, lv->name);
+					r = 0;
+				}
+				if (strcasecmp(rdev->name, rdevb->name) == 0) {
+					log_error("Internal error: Duplicate device name "
+						  "%s detected for replicator %s",
+						  rdev->name, lv->name);
+					r = 0;
+				}
+				if (rdev->device_index == rdevb->device_index) {
+					log_error("Internal error: Duplicate device index %"
+						  PRId64 " detected for replicator %s/%s",
+						  rdev->device_index, lv->name, rsite->name);
+					r = 0;
+				}
+			}
+		}
+	}
+
+	return r;
+}
+
 int vg_validate(struct volume_group *vg)
 {
 	struct pv_list *pvl, *pvl2;
@@ -2188,6 +2249,9 @@ int vg_validate(struct volume_group *vg)
 				r = 0;
 			}
 		}
+
+		if (lv_is_replicator(lvl->lv) && !_replicator_validate(lvl->lv))
+			r = 0;
 	}
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
-- 
1.6.5.1

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

* [PATCH 10/18] Replicator: extend _lv_each_dependency() rep. deps
  2009-11-02 14:20                 ` [PATCH 09/18] Replicator: vg validation Zdenek Kabelac
@ 2009-11-02 14:20                   ` Zdenek Kabelac
  2009-11-02 14:20                     ` [PATCH 11/18] Replicator: update _create_partial_dtree() Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/metadata/metadata.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index ebb2f16..3743c89 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1927,6 +1927,8 @@ static int _lv_each_dependency(struct logical_volume *lv,
 	struct lv_segment *lvseg;
 
 	struct logical_volume *deps[] = {
+		(lv->rdevice && lv != lv->rdevice->lv) ? lv->rdevice->lv : 0,
+		(lv->rdevice && lv != lv->rdevice->slog) ? lv->rdevice->slog : 0,
 		lv->snapshot ? lv->snapshot->origin : 0,
 		lv->snapshot ? lv->snapshot->cow : 0 };
 	for (i = 0; i < sizeof(deps) / sizeof(*deps); ++i) {
@@ -1937,6 +1939,8 @@ static int _lv_each_dependency(struct logical_volume *lv,
 	dm_list_iterate_items(lvseg, &lv->segments) {
 		if (lvseg->log_lv && !fn(lvseg->log_lv, data))
 			return_0;
+		if (lvseg->rlog_lv && !fn(lvseg->rlog_lv, data))
+			return_0;
 		for (s = 0; s < lvseg->area_count; ++s) {
 			if (seg_type(lvseg, s) == AREA_LV && !fn(seg_lv(lvseg,s), data))
 				return_0;
-- 
1.6.5.1

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

* [PATCH 11/18] Replicator: update _create_partial_dtree()
  2009-11-02 14:20                   ` [PATCH 10/18] Replicator: extend _lv_each_dependency() rep. deps Zdenek Kabelac
@ 2009-11-02 14:20                     ` Zdenek Kabelac
  2009-11-02 14:20                       ` [PATCH 12/18] Replicator: add replicator to dtree Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Creating partial tree for Replicator target.
Using dm_tree_set_priority() to set higher priority for Replicator.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/activate/dev_manager.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index a4ae9e0..1f1d645 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -731,6 +731,9 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi
 	struct dm_list *snh, *snht;
 	struct lv_segment *seg;
 	uint32_t s;
+	struct replicator_device *rdev;
+	struct replicator_site *rsite;
+	const char *replicator_dlid;
 
 	if (!(dtree = dm_tree_create())) {
 		log_error("Partial dtree creation failed for %s.", lv->name);
@@ -746,12 +749,34 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi
 			goto_bad;
 
 	/* Add any LVs used by segments in this LV */
-	dm_list_iterate_items(seg, &lv->segments)
+	dm_list_iterate_items(seg, &lv->segments) {
 		for (s = 0; s < seg->area_count; s++)
 			if (seg_type(seg, s) == AREA_LV && seg_lv(seg, s)) {
 				if (!_add_lv_to_dtree(dm, dtree, seg_lv(seg, s)))
 					goto_bad;
 			}
+		if (seg->replicator) {
+                        /* Add all replicator-dev from same replicator */
+			dm_list_iterate_items(rsite, &seg->replicator->rsites) {
+				dm_list_iterate_items(rdev, &rsite->rdevices) {
+					if (rsite->state == REPLICATOR_STATE_ACTIVE) {
+						if (!rdev->replicator_dev->lv)
+							goto_bad;
+						if (lv == rdev->replicator_dev->lv)
+                                                        continue;
+						/* Add replicator-dev LV */
+						if (!_add_lv_to_dtree(dm, dtree, rdev->replicator_dev->lv))
+							goto_bad;
+					}
+				}
+			}
+
+			if (!(replicator_dlid = build_dlid(dm, seg->replicator->lvid.s, NULL)))
+				goto_bad;
+			if (!dm_tree_set_replicator_suspend(dtree, replicator_dlid))
+				goto_bad;
+		}
+	}
 
 	return dtree;
 
-- 
1.6.5.1

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

* [PATCH 12/18] Replicator: add replicator to dtree
  2009-11-02 14:20                     ` [PATCH 11/18] Replicator: update _create_partial_dtree() Zdenek Kabelac
@ 2009-11-02 14:20                       ` Zdenek Kabelac
  2009-11-02 14:20                         ` [PATCH 13/18] Replicator: do not remove of replicators' LVs Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Adding all replicator related LVs to dtree.
Start of one replicator_dev initiate start of all other related.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/activate/dev_manager.c |   49 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 1f1d645..00f3cf3 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -951,6 +951,47 @@ static int _add_target_to_dtree(struct dev_manager *dm,
 static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
 				  struct logical_volume *lv, const char *layer);
 
+/* Add all replicators' LVs from active segment */
+static int _add_replicator_dev_target_to_dtree(struct dev_manager *dm,
+					       struct dm_tree *dtree,
+					       struct lv_segment *seg)
+{
+	struct replicator_device *rdev;
+	struct replicator_site *rsite;
+
+	/* only active replicator */
+	if (lv_is_active_replicator_dev(seg->lv)) {
+		/* activation of one replicator node activate all other nodes */
+		if (!seg->replicator ||
+		    !_add_new_lv_to_dtree(dm, dtree, seg->replicator, NULL))
+			return_0;
+
+		dm_list_iterate_items(rsite, &seg->replicator->rsites) {
+			dm_list_iterate_items(rdev, &rsite->rdevices) {
+				if (rdev->slog && !_add_new_lv_to_dtree(dm, dtree, rdev->slog, NULL))
+					return_0;
+				if ((rsite->state == REPLICATOR_STATE_ACTIVE) &&
+				    (!rdev->lv || !_add_new_lv_to_dtree(dm, dtree, rdev->lv, NULL)))
+					return_0;
+			}
+		}
+		dm_list_iterate_items(rsite, &seg->replicator->rsites) {
+			if (rsite->state != REPLICATOR_STATE_ACTIVE)
+				continue;
+			dm_list_iterate_items(rdev, &rsite->rdevices) {
+				if (rdev->replicator_dev->lv == seg->lv)
+					continue;
+				if (!rdev->replicator_dev->lv ||
+				    !_add_new_lv_to_dtree(dm, dtree, rdev->replicator_dev->lv, NULL))
+					return_0;
+			}
+		}
+	} else if (!_add_new_lv_to_dtree(dm, dtree, seg->lv->rdevice->lv, NULL))
+		return_0;
+
+	return 1;
+}
+
 static int _add_segment_to_dtree(struct dev_manager *dm,
 				   struct dm_tree *dtree,
 				   struct dm_tree_node *dnode,
@@ -981,8 +1022,14 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
 	    !_add_new_lv_to_dtree(dm, dtree, seg->log_lv, NULL))
 		return_0;
 
+	if (seg_is_replicator_dev(seg)) {
+		if (!_add_replicator_dev_target_to_dtree(dm, dtree, seg))
+			return_0;
+	} else if (seg_is_replicator(seg) && seg->rlog_lv) {
+		if (!_add_new_lv_to_dtree(dm, dtree, seg->rlog_lv, NULL))
+			return_0;
 	/* If this is a snapshot origin, add real LV */
-	if (lv_is_origin(seg->lv) && !layer) {
+	} else if (lv_is_origin(seg->lv) && !layer) {
 		if (vg_is_clustered(seg->lv->vg)) {
 			log_error("Clustered snapshots are not yet supported");
 			return 0;
-- 
1.6.5.1

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

* [PATCH 13/18] Replicator: do not remove of replicators' LVs
  2009-11-02 14:20                       ` [PATCH 12/18] Replicator: add replicator to dtree Zdenek Kabelac
@ 2009-11-02 14:20                         ` Zdenek Kabelac
  2009-11-02 14:20                           ` [PATCH 14/18] Replicator: activate change for vgchange Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/metadata/lv_manip.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f3e6511..816c5b6 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2084,6 +2084,15 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
 		return 0;
 	}
 
+	if (lv_is_replicator_dev(lv) ||
+	    lv_is_rimage(lv) ||
+	    lv_is_rlog(lv) ||
+	    lv_is_slog(lv)) {
+		log_error("Can't remove logical volume %s used by a replicator",
+			  lv->name);
+		return 0;
+	}
+
 	if (lv->status & LOCKED) {
 		log_error("Can't remove locked LV %s", lv->name);
 		return 0;
-- 
1.6.5.1

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

* [PATCH 14/18] Replicator: activate change for vgchange
  2009-11-02 14:20                         ` [PATCH 13/18] Replicator: do not remove of replicators' LVs Zdenek Kabelac
@ 2009-11-02 14:20                           ` Zdenek Kabelac
  2009-11-02 14:20                             ` [PATCH 15/18] Replicator: add new options for replicator Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Activate only replicator-dev lv. Activation of one replicator-dev LV
will activivate also all other related LVs.

NOTE:
When the patch for skipping of utomatic activation of hidden volumes
is applied this patch can be simplified

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 tools/vgchange.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/vgchange.c b/tools/vgchange.c
index d6af3b0..7fefe0a 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -69,6 +69,12 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
 		if ((lv->status & MIRROR_IMAGE) || (lv->status & MIRROR_LOG))
 			continue;
 
+		/* Only request activation of the first replicator-dev LV */
+		if (lv_is_rlog(lv) || lv_is_slog(lv) || lv_is_rimage(lv) ||
+		    lv_is_replicator(lv) ||
+		    (lv_is_replicator_dev(lv) && (lv != first_replicator_dev(lv))))
+			continue;
+
 		/* Can't deactivate a pvmove LV */
 		/* FIXME There needs to be a controlled way of doing this */
 		if (((activate == CHANGE_AN) || (activate == CHANGE_ALN)) &&
-- 
1.6.5.1

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

* [PATCH 15/18] Replicator: add new options for replicator
  2009-11-02 14:20                           ` [PATCH 14/18] Replicator: activate change for vgchange Zdenek Kabelac
@ 2009-11-02 14:20                             ` Zdenek Kabelac
  2009-11-02 14:20                               ` [PATCH 16/18] Replicator: update copyright dates Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

New options: addsite, delsite, replicator,
replicatorlog, replicatorlogtype.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/config/defaults.h            |    1 +
 lib/metadata/metadata-exported.h |    1 +
 tools/args.h                     |    5 ++++
 tools/commands.h                 |   10 ++++++-
 tools/lvcreate.c                 |   47 ++++++++++++++++++++++++++++++++++++++
 tools/lvmcmdline.c               |    9 +++++++
 tools/tools.h                    |    1 +
 7 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 824fec2..e904e58 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -103,6 +103,7 @@
 
 #define DEFAULT_STRIPE_FILLER "error"
 #define DEFAULT_MIRROR_REGION_SIZE 512	/* KB */
+#define DEFAULT_REPLICATOR_REGION_SIZE 512	/* KB */
 #define DEFAULT_INTERVAL 15
 
 #ifdef READLINE_SUPPORT
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 257165c..2ca2d81 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -584,6 +584,7 @@ uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
 struct lvcreate_params {
 	/* flags */
 	int snapshot; /* snap */
+	int replicator; /* replicator */
 	int zero; /* all */
 	int major; /* all */
 	int minor; /* all */
diff --git a/tools/args.h b/tools/args.h
index 1f2427b..40b92b3 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -64,6 +64,11 @@ arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0)
 arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
 arg(virtualsize_ARG, '\0', "virtualsize", size_mb_arg, 0)
 arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0)
+arg(replicator_ARG, '\0', "replicator", NULL, 0)
+arg(replicatorlog_ARG, '\0', "replicatorlog", NULL, 0)
+arg(replicatorlogtype_ARG, '\0', "replicatorlogtype", NULL, 0)
+arg(addsite_ARG, '\0', "addsite", site_arg, 0)
+arg(delsite_ARG, '\0', "delsite", site_arg, 0)
 
 /* Allow some variations */
 arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index 85222e4..fc37889 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -62,10 +62,12 @@ xx(lvchange,
    "lvchange\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-a|--available [e|l]y|n]\n"
+   "\t[--addsite Site]\n"
    "\t[--addtag Tag]\n"
    "\t[--alloc AllocationPolicy]\n"
    "\t[-C|--contiguous y|n]\n"
    "\t[-d|--debug]\n"
+   "\t[--delsite Site]\n"
    "\t[--deltag Tag]\n"
    "\t[-f|--force]\n"
    "\t[-h|--help]\n"
@@ -89,7 +91,7 @@ xx(lvchange,
    ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
    monitor_ARG, noudevsync_ARG, partial_ARG, permission_ARG, persistent_ARG,
    readahead_ARG, resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG,
-   yes_ARG)
+   addsite_ARG, delsite_ARG, yes_ARG)
 
 xx(lvconvert,
    "Change logical volume layout",
@@ -145,6 +147,9 @@ xx(lvcreate,
    "\t[-p|--permission {r|rw}]\n"
    "\t[-r|--readahead ReadAheadSectors|auto|none]\n"
    "\t[-R|--regionsize MirrorLogRegionSize]\n"
+   "\t[--replicator]\n"
+   "\t[--replicatorlog LogicalVolumeName]\n"
+   "\t[--replicatorlogtype ringbuffer]\n"
    "\t[-t|--test]\n"
    "\t[--type VolumeType]\n"
    "\t[-v|--verbose]\n"
@@ -179,7 +184,8 @@ xx(lvcreate,
    addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG,
    corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrorlog_ARG, mirrors_ARG,
    name_ARG, nosync_ARG, noudevsync_ARG, permission_ARG, persistent_ARG,
-   readahead_ARG, regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG,
+   readahead_ARG, regionsize_ARG, replicator_ARG, replicatorlog_ARG,
+   replicatorlogtype_ARG, size_ARG, snapshot_ARG, stripes_ARG,
    stripesize_ARG, test_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG,
    zero_ARG)
 
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index be6b5cc..6f71aaf 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -373,6 +373,36 @@ static int _read_mirror_params(struct lvcreate_params *lp,
 	return 1;
 }
 
+static int _read_replicator_params(struct lvcreate_params *lp,
+			       struct cmd_context *cmd)
+{
+	int region_size;
+	const char *mirrorlog;
+
+	if (arg_count(cmd, regionsize_ARG)) {
+		if (arg_sign_value(cmd, regionsize_ARG, 0) == SIGN_MINUS) {
+			log_error("Negative regionsize is invalid");
+			return 0;
+		}
+		lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0);
+	} else {
+		region_size = 2 * find_config_tree_int(cmd,
+						       "activation/replicator_region_size",
+						       DEFAULT_REPLICATOR_REGION_SIZE);
+		if (region_size < 0) {
+			log_error("Negative regionsize in configuration file "
+				  "is invalid");
+			return 0;
+		}
+		lp->region_size = region_size;
+	}
+
+	if (!_validate_mirror_params(cmd, lp))
+		return 0;
+
+	return 1;
+}
+
 static int _lvcreate_params(struct lvcreate_params *lp,
 			    struct lvcreate_cmdline_params *lcp,
 			    struct cmd_context *cmd,
@@ -405,6 +435,9 @@ static int _lvcreate_params(struct lvcreate_params *lp,
 	if (seg_is_mirrored(lp))
 		lp->mirrors = 2;
 
+	if (seg_is_replicator(lp) || arg_count(cmd, replicator_ARG))
+		lp->replicator = 1;
+
 	if (arg_count(cmd, mirrors_ARG)) {
 		lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
 		if (lp->mirrors == 1)
@@ -469,6 +502,20 @@ static int _lvcreate_params(struct lvcreate_params *lp,
 		}
 	}
 
+	if (lp->replicator) {
+		log_error("--replicator for replicators");
+
+	} else {
+		if (arg_count(cmd, replicatorlog_ARG)) {
+			log_error("--replicatorlog is only available with replicators");
+			return 0;
+		}
+		if (arg_count(cmd, replicatorlogtype_ARG)) {
+			log_error("--replicatorlogtype is only available with replicators");
+			return 0;
+		}
+	}
+
 	if (activation() && lp->segtype->ops->target_present &&
 	    !lp->segtype->ops->target_present(cmd, NULL, NULL)) {
 		log_error("%s: Required device-mapper target(s) not "
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 31ebd12..cdfef3f 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -483,6 +483,15 @@ int readahead_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
 	return 1;
 }
 
+int site_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
+{
+	char *pos = a->value;
+	if (!validate_name(pos))
+		return 0;
+
+	return 1;
+}
+
 static void __alloc(int size)
 {
 	if (!(_cmdline.commands = dm_realloc(_cmdline.commands, sizeof(*_cmdline.commands) * size))) {
diff --git a/tools/tools.h b/tools/tools.h
index 3afa1a1..67b2178 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -151,6 +151,7 @@ int units_arg(struct cmd_context *cmd, struct arg *a);
 int segtype_arg(struct cmd_context *cmd, struct arg *a);
 int alloc_arg(struct cmd_context *cmd, struct arg *a);
 int readahead_arg(struct cmd_context *cmd, struct arg *a);
+int site_arg(struct cmd_context *cmd, struct arg *a);
 
 /* we use the enums to access the switches */
 unsigned int arg_count(const struct cmd_context *cmd, int a);
-- 
1.6.5.1

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

* [PATCH 16/18] Replicator: update copyright dates
  2009-11-02 14:20                             ` [PATCH 15/18] Replicator: add new options for replicator Zdenek Kabelac
@ 2009-11-02 14:20                               ` Zdenek Kabelac
  2009-11-02 14:20                                 ` [PATCH 17/18] Replicator: new variable in generated file Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 lib/activate/dev_manager.c |    2 +-
 lib/metadata/segtype.h     |    2 +-
 libdm/libdm-deptree.c      |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 00f3cf3..ab4327c 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
index 20a032f..dfdb7bf 100644
--- a/lib/metadata/segtype.h
+++ b/lib/metadata/segtype.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 652b9e8..4ccaad3 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2005-2009 Red Hat, Inc. All rights reserved.
  *
  * This file is part of the device-mapper userspace tools.
  *
-- 
1.6.5.1

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

* [PATCH 17/18] Replicator: new variable in generated file
  2009-11-02 14:20                               ` [PATCH 16/18] Replicator: update copyright dates Zdenek Kabelac
@ 2009-11-02 14:20                                 ` Zdenek Kabelac
  2009-11-02 14:20                                   ` [PATCH 18/18] Replicator: update of generated configure file Zdenek Kabelac
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

---
 lib/misc/configure.h.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in
index 4273eeb..a49cd6e 100644
--- a/lib/misc/configure.h.in
+++ b/lib/misc/configure.h.in
@@ -419,6 +419,9 @@
 /* Define to 1 to include the LVM readline shell. */
 #undef READLINE_SUPPORT
 
+/* Define to 1 to include built-in support for replicator. */
+#undef REPLICATOR_INTERNAL
+
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
-- 
1.6.5.1

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

* [PATCH 18/18] Replicator: update of generated configure file
  2009-11-02 14:20                                 ` [PATCH 17/18] Replicator: new variable in generated file Zdenek Kabelac
@ 2009-11-02 14:20                                   ` Zdenek Kabelac
  0 siblings, 0 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-02 14:20 UTC (permalink / raw)
  To: dm-devel; +Cc: Zdenek Kabelac

---
 configure |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 7da2d3c..d01d867 100755
--- a/configure
+++ b/configure
@@ -655,6 +655,7 @@ SELINUX_LIBS
 POOL
 PKGCONFIG
 OWNER
+REPLICATOR
 MIRRORS
 LVM_RELEASE_DATE
 LVM_RELEASE
@@ -814,6 +815,7 @@ with_pool
 with_cluster
 with_snapshots
 with_mirrors
+with_replicator
 enable_readline
 enable_realtime
 with_clvmd
@@ -1546,6 +1548,8 @@ Optional Packages:
                           TYPE=internal
   --with-mirrors=TYPE     Mirror support: internal/shared/none
                           TYPE=internal
+  --with-replicator=TYPE  Replicator support: internal/shared/none
+                          [TYPE=none]
   --with-clvmd=TYPE       Build cluster LVM Daemon.
                           The following cluster manager combinations are valid:
                            * cman,gulm             (RHEL4 or equivalent)
@@ -9325,6 +9329,32 @@ _ACEOF
 fi
 
 ################################################################################
+{ $as_echo "$as_me:$LINENO: checking whether to include replicator" >&5
+$as_echo_n "checking whether to include replicator... " >&6; }
+
+# Check whether --with-replicator was given.
+if test "${with_replicator+set}" = set; then
+  withval=$with_replicator;  REPLICATOR="$withval"
+else
+   REPLICATOR="none"
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $REPLICATOR" >&5
+$as_echo "$REPLICATOR" >&6; }
+
+case "$REPLICATOR" in
+ none|shared) ;;
+ internal)
+cat >>confdefs.h <<\_ACEOF
+#define REPLICATOR_INTERNAL 1
+_ACEOF
+ ;;
+ *) { { $as_echo "$as_me:$LINENO: error: --with-replicator parameter invalid ($REPLICATOR)" >&5
+$as_echo "$as_me: error: --with-replicator parameter invalid ($REPLICATOR)" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+################################################################################
 { $as_echo "$as_me:$LINENO: checking whether to enable readline" >&5
 $as_echo_n "checking whether to enable readline... " >&6; }
 # Check whether --enable-readline was given.
@@ -15525,8 +15555,9 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
 
 
 
+
 ################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/lvm2_monitoring_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/lvm2_monitoring_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile udev/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -16143,6 +16174,7 @@ do
     "lib/format_pool/Makefile") CONFIG_FILES="$CONFIG_FILES lib/format_pool/Makefile" ;;
     "lib/locking/Makefile") CONFIG_FILES="$CONFIG_FILES lib/locking/Makefile" ;;
     "lib/mirror/Makefile") CONFIG_FILES="$CONFIG_FILES lib/mirror/Makefile" ;;
+    "lib/replicator/Makefile") CONFIG_FILES="$CONFIG_FILES lib/replicator/Makefile" ;;
     "lib/misc/lvm-version.h") CONFIG_FILES="$CONFIG_FILES lib/misc/lvm-version.h" ;;
     "lib/snapshot/Makefile") CONFIG_FILES="$CONFIG_FILES lib/snapshot/Makefile" ;;
     "libdm/Makefile") CONFIG_FILES="$CONFIG_FILES libdm/Makefile" ;;
-- 
1.6.5.1

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

* Re: [PATCH 01/18] Adding fflush after yes/no prompt
  2009-11-02 14:20 ` [PATCH 01/18] Adding fflush after yes/no prompt Zdenek Kabelac
  2009-11-02 14:20   ` [PATCH 02/18] Export outnl and indent functions for modules Zdenek Kabelac
@ 2009-11-02 14:49   ` Alasdair G Kergon
  1 sibling, 0 replies; 27+ messages in thread
From: Alasdair G Kergon @ 2009-11-02 14:49 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: device-mapper development

On Mon, Nov 02, 2009 at 03:20:05PM +0100, Zdenek Kabelac wrote:
> Add fflush in case the log is redirected to buffered file.
> It might not be obvious why the application wait on stdin as the
> prompt might not be flushed to the file without this patch.
 
Ack.

Alasdair

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

* Re: [PATCH 02/18] Export outnl and indent functions for modules
  2009-11-02 14:20   ` [PATCH 02/18] Export outnl and indent functions for modules Zdenek Kabelac
  2009-11-02 14:20     ` [PATCH 03/18] Export outsz() and outhnt() " Zdenek Kabelac
@ 2009-11-02 14:50     ` Alasdair G Kergon
  1 sibling, 0 replies; 27+ messages in thread
From: Alasdair G Kergon @ 2009-11-02 14:50 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: dm-devel

On Mon, Nov 02, 2009 at 03:20:06PM +0100, Zdenek Kabelac wrote:
> Exporting functions out_inc_indent(), out_dec_indent() for creating
> indented metadata lines. Macro outnl() is using out_newline()
> instead of direct f->fn() that required the visibility of internal
> struct formatter.
 
Ack.

Alasdair

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

* Re: [PATCH 03/18] Export outsz() and outhnt() for modules
  2009-11-02 14:20     ` [PATCH 03/18] Export outsz() and outhnt() " Zdenek Kabelac
  2009-11-02 14:20       ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Zdenek Kabelac
@ 2009-11-02 14:54       ` Alasdair G Kergon
  2009-11-03 11:04         ` Zdenek Kabelac
  1 sibling, 1 reply; 27+ messages in thread
From: Alasdair G Kergon @ 2009-11-02 14:54 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: dm-devel

On Mon, Nov 02, 2009 at 03:20:07PM +0100, Zdenek Kabelac wrote:
> Adding macro outsz() for out_size() and outhnt() for out_hint()
> that checks for error in a similar way as outf() does for out_text()
 
Ack.

outhint rather than outhnt perhaps?

Alasdair

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

* Re: [PATCH 04/18] Export outfc() macro and out_text_with_comment()
  2009-11-02 14:20       ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Zdenek Kabelac
  2009-11-02 14:20         ` [PATCH 05/18] Use outsz macro Zdenek Kabelac
@ 2009-11-02 14:56         ` Alasdair G Kergon
  1 sibling, 0 replies; 27+ messages in thread
From: Alasdair G Kergon @ 2009-11-02 14:56 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: dm-devel

On Mon, Nov 02, 2009 at 03:20:08PM +0100, Zdenek Kabelac wrote:
> Support also commented lines with out_text_with_comment() API call.
> It is similar to out_text() function and it takes extra argument
> for comment. Macro outfc() is similar to outf().
 
Ack.

Alasdair

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

* Re: [PATCH 05/18] Use outsz macro
  2009-11-02 14:20         ` [PATCH 05/18] Use outsz macro Zdenek Kabelac
  2009-11-02 14:20           ` [PATCH 06/18] Replicator: add libdm support Zdenek Kabelac
@ 2009-11-02 14:59           ` Alasdair G Kergon
  1 sibling, 0 replies; 27+ messages in thread
From: Alasdair G Kergon @ 2009-11-02 14:59 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: dm-devel

On Mon, Nov 02, 2009 at 03:20:09PM +0100, Zdenek Kabelac wrote:
> Using outsz() macro instead of direct call of out_size() with check
> for error status of this function.
 
Ack.

(Once this is in place, we should change the external code back to using
the more-meaningful 'out_size' by renaming the macros and fns.)

Alasdair

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

* Re: [PATCH 03/18] Export outsz() and outhnt() for modules
  2009-11-02 14:54       ` [PATCH 03/18] Export outsz() and outhnt() for modules Alasdair G Kergon
@ 2009-11-03 11:04         ` Zdenek Kabelac
  0 siblings, 0 replies; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-03 11:04 UTC (permalink / raw)
  To: dm-devel

Dne 2.11.2009 15:54, Alasdair G Kergon napsal(a):
> On Mon, Nov 02, 2009 at 03:20:07PM +0100, Zdenek Kabelac wrote:
>> Adding macro outsz() for out_size() and outhnt() for out_hint()
>> that checks for error in a similar way as outf() does for out_text()
>  
> Ack.
> 
> outhint rather than outhnt perhaps?

In that case probably outsize() as well with outhint() ?

Zdenek

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

* Re: [PATCH 07/18] Replicator: suspend/deactivate replicator
  2009-11-02 14:20             ` [PATCH 07/18] Replicator: suspend/deactivate replicator Zdenek Kabelac
       [not found]               ` <1257171622-8380-9-git-send-email-zkabelac@redhat.com>
@ 2009-11-03 16:46               ` Mike Snitzer
  2009-11-04 10:05                 ` Zdenek Kabelac
  1 sibling, 1 reply; 27+ messages in thread
From: Mike Snitzer @ 2009-11-03 16:46 UTC (permalink / raw)
  To: device-mapper development; +Cc: Zdenek Kabelac

On Mon, Nov 02 2009 at  9:20am -0500,
Zdenek Kabelac <zkabelac@redhat.com> wrote:

> Introducing dm_tree_set_replicator_suspend() to suspend
> replicator control device before actual deactivation of replicator-dev
> head device.
> 
> Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
> ---
>  libdm/.exported_symbols |    1 +
>  libdm/libdevmapper.h    |    2 +
>  libdm/libdm-deptree.c   |   63 +++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 66 insertions(+), 0 deletions(-)
> 
> diff --git a/libdm/.exported_symbols b/libdm/.exported_symbols
> index 7b5e3f0..3217e03 100644
> --- a/libdm/.exported_symbols
> +++ b/libdm/.exported_symbols
> @@ -79,6 +79,7 @@ dm_tree_node_add_mirror_target_log
>  dm_tree_node_add_target_area
>  dm_tree_node_add_replicator_target
>  dm_tree_node_add_replicator_dev_target
> +dm_tree_set_replicator_suspend
>  dm_tree_node_set_read_ahead
>  dm_tree_skip_lockfs
>  dm_tree_use_no_flush_suspend
> diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
> index f96aed3..66ce055 100644
> --- a/libdm/libdevmapper.h
> +++ b/libdm/libdevmapper.h
> @@ -457,6 +457,8 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
>  					   uint32_t slog_flags,		/* Mirror log flags */
>  					   uint32_t slog_size);
>  
> +int dm_tree_set_replicator_suspend(struct dm_tree *dtree, const char *uuid);
> +
>  int dm_tree_node_add_target_area(struct dm_tree_node *node,
>  				    const char *dev_name,
>  				    const char *dlid,
> diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
> index 0ba4e7e..652b9e8 100644
> --- a/libdm/libdm-deptree.c
> +++ b/libdm/libdm-deptree.c
> @@ -157,6 +157,7 @@ struct dm_tree_node {
>          struct dm_list used_by;    	/* Nodes that use this node */
>  
>  	int activation_priority;	/* 0 gets activated first */
> +	int replicator_suspend;		/* 1 gets suspend first */
>  
>  	uint16_t udev_flags;		/* Udev control flags */
>  

I think it would be wise to make this more generic,
e.g. "suspend_priority".

It could be that other future devices would like to prioritize the
suspend sequence too.  Having a means to do so (without using a
seemingly replicator-specific node attribute) would be good.

So this really just amounts to: s/replicator_suspend/suspend_priority/

Mike

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

* Re: [PATCH 07/18] Replicator: suspend/deactivate replicator
  2009-11-03 16:46               ` [PATCH 07/18] Replicator: suspend/deactivate replicator Mike Snitzer
@ 2009-11-04 10:05                 ` Zdenek Kabelac
  2009-11-04 14:15                   ` Mike Snitzer
  0 siblings, 1 reply; 27+ messages in thread
From: Zdenek Kabelac @ 2009-11-04 10:05 UTC (permalink / raw)
  To: dm-devel

Dne 3.11.2009 17:46, Mike Snitzer napsal(a):
> On Mon, Nov 02 2009 at  9:20am -0500,
> Zdenek Kabelac <zkabelac@redhat.com> wrote:
> 
>> Introducing dm_tree_set_replicator_suspend() to suspend
>> replicator control device before actual deactivation of replicator-dev
>> head device.
>>
>>
>>  	int activation_priority;	/* 0 gets activated first */
>> +	int replicator_suspend;		/* 1 gets suspend first */
>>  
>>  	uint16_t udev_flags;		/* Udev control flags */
>>  
> 
> I think it would be wise to make this more generic,
> e.g. "suspend_priority".
> 
> It could be that other future devices would like to prioritize the
> suspend sequence too.  Having a means to do so (without using a
> seemingly replicator-specific node attribute) would be good.
> 
> So this really just amounts to: s/replicator_suspend/suspend_priority/


  I think using 'priority' would be more challenging here - for replicator it
is only needs to check parental node - while with priority you would probably
expect full tree traversal to see whether there is node which should be
suspend in front of current device - thought the code could be probably
extended in a way to specify recursive traversal depth - for replicator tree
depth 1 is enough.

  Previous implementation was probably more generic in this, but required API
changes - the use case for current implementation is rather focused on the
replicator's needs with the advantage, it will not influence anything else.

  I think at this moment this API is static internal and might be probably
easily changed/modified once some similar target would need to use it ?
(It's not easy to predict future use case)

Zdenek

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

* Re: [PATCH 07/18] Replicator: suspend/deactivate replicator
  2009-11-04 10:05                 ` Zdenek Kabelac
@ 2009-11-04 14:15                   ` Mike Snitzer
  0 siblings, 0 replies; 27+ messages in thread
From: Mike Snitzer @ 2009-11-04 14:15 UTC (permalink / raw)
  To: device-mapper development

On Wed, Nov 04 2009 at  5:05am -0500,
Zdenek Kabelac <zkabelac@redhat.com> wrote:

> Dne 3.11.2009 17:46, Mike Snitzer napsal(a):
> > On Mon, Nov 02 2009 at  9:20am -0500,
> > Zdenek Kabelac <zkabelac@redhat.com> wrote:
> > 
> >> Introducing dm_tree_set_replicator_suspend() to suspend
> >> replicator control device before actual deactivation of replicator-dev
> >> head device.
> >>
> >>
> >>  	int activation_priority;	/* 0 gets activated first */
> >> +	int replicator_suspend;		/* 1 gets suspend first */
> >>  
> >>  	uint16_t udev_flags;		/* Udev control flags */
> >>  
> > 
> > I think it would be wise to make this more generic,
> > e.g. "suspend_priority".
> > 
> > It could be that other future devices would like to prioritize the
> > suspend sequence too.  Having a means to do so (without using a
> > seemingly replicator-specific node attribute) would be good.
> > 
> > So this really just amounts to: s/replicator_suspend/suspend_priority/
> 
> 
>   I think using 'priority' would be more challenging here - for replicator it
> is only needs to check parental node - while with priority you would probably
> expect full tree traversal to see whether there is node which should be
> suspend in front of current device - thought the code could be probably
> extended in a way to specify recursive traversal depth - for replicator tree
> depth 1 is enough.
> 
>   Previous implementation was probably more generic in this, but required API
> changes - the use case for current implementation is rather focused on the
> replicator's needs with the advantage, it will not influence anything else.
> 
>   I think at this moment this API is static internal and might be probably
> easily changed/modified once some similar target would need to use it ?
> (It's not easy to predict future use case)

Fair enough, and maybe my naming suggestion of "suspend_priority" wasn't
quite right but I was just thinking there isn't a need to make this flag
replicator specific.  But you're right, if something else needs it in
the future we can change it then.

Mike

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

end of thread, other threads:[~2009-11-04 14:15 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-02 14:20 Replicator part for lvm Zdenek Kabelac
2009-11-02 14:20 ` [PATCH 01/18] Adding fflush after yes/no prompt Zdenek Kabelac
2009-11-02 14:20   ` [PATCH 02/18] Export outnl and indent functions for modules Zdenek Kabelac
2009-11-02 14:20     ` [PATCH 03/18] Export outsz() and outhnt() " Zdenek Kabelac
2009-11-02 14:20       ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Zdenek Kabelac
2009-11-02 14:20         ` [PATCH 05/18] Use outsz macro Zdenek Kabelac
2009-11-02 14:20           ` [PATCH 06/18] Replicator: add libdm support Zdenek Kabelac
2009-11-02 14:20             ` [PATCH 07/18] Replicator: suspend/deactivate replicator Zdenek Kabelac
     [not found]               ` <1257171622-8380-9-git-send-email-zkabelac@redhat.com>
2009-11-02 14:20                 ` [PATCH 09/18] Replicator: vg validation Zdenek Kabelac
2009-11-02 14:20                   ` [PATCH 10/18] Replicator: extend _lv_each_dependency() rep. deps Zdenek Kabelac
2009-11-02 14:20                     ` [PATCH 11/18] Replicator: update _create_partial_dtree() Zdenek Kabelac
2009-11-02 14:20                       ` [PATCH 12/18] Replicator: add replicator to dtree Zdenek Kabelac
2009-11-02 14:20                         ` [PATCH 13/18] Replicator: do not remove of replicators' LVs Zdenek Kabelac
2009-11-02 14:20                           ` [PATCH 14/18] Replicator: activate change for vgchange Zdenek Kabelac
2009-11-02 14:20                             ` [PATCH 15/18] Replicator: add new options for replicator Zdenek Kabelac
2009-11-02 14:20                               ` [PATCH 16/18] Replicator: update copyright dates Zdenek Kabelac
2009-11-02 14:20                                 ` [PATCH 17/18] Replicator: new variable in generated file Zdenek Kabelac
2009-11-02 14:20                                   ` [PATCH 18/18] Replicator: update of generated configure file Zdenek Kabelac
2009-11-03 16:46               ` [PATCH 07/18] Replicator: suspend/deactivate replicator Mike Snitzer
2009-11-04 10:05                 ` Zdenek Kabelac
2009-11-04 14:15                   ` Mike Snitzer
2009-11-02 14:59           ` [PATCH 05/18] Use outsz macro Alasdair G Kergon
2009-11-02 14:56         ` [PATCH 04/18] Export outfc() macro and out_text_with_comment() Alasdair G Kergon
2009-11-02 14:54       ` [PATCH 03/18] Export outsz() and outhnt() for modules Alasdair G Kergon
2009-11-03 11:04         ` Zdenek Kabelac
2009-11-02 14:50     ` [PATCH 02/18] Export outnl and indent functions " Alasdair G Kergon
2009-11-02 14:49   ` [PATCH 01/18] Adding fflush after yes/no prompt Alasdair G Kergon

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.