Replicator lvm support
cover Replicator lvm support
Set of patches to introduce LVM support for dm target replicator. Patches without Replicator: prefix are generic simple patches or some minor code cleanups - they are here just to get accurate diffs.
Replicator part of this patch set first adds libdm support followed by lvm support.
Tricky part is the usage of sorted vg_name_list.
This patch set doesn't yet contain functional lvm commands for creation of replicator, so for activation and deactivation hand written meta-data must be used.
Current code will activate also VGs from remote volume groups if they are not yet active and work with already active remote VGs. Deactivation will leave remove VGs active.
So far only vgchange works for activation, lvchange is in the progress.
Zdenek Kabelac (23):
Indent changes
Skip cast of void* for assigment
Simple indent changes to fit 80 chars per line Export outsz() and outhnt() for modules Export outfc() macro and out_text_with_comment() Use outsz macro
Replicator: add libdm support
Replicator: suspend/deactivate replicator
Replicator: add lvm support
Replicator: validation of replicator segments
Replicator: extend _lv_each_dependency() rep. deps
Replicator: add sorted vg_name_list
Replicator: use vg_name_list for _process_one_vg()
Replicator: update _create_partial_dtree()
Replicator: using vgs_missed for error count
Replicator: add vgs_print for message postponing
Replicator: add replicator to dtree
Replicator: do not remove of replicators' LVs
Replicator: activate change for vgchange
Replicator: add new options for replicator
Replicator: update copyright dates
Replicator: new variable in generated file
Replicator: update of generated configure file
configure | 34 ++- configure.in | 17 + lib/Makefile.in | 9 + lib/activate/dev_manager.c | 172 ++++++++- lib/commands/toolcontext.c | 5 + lib/commands/toolcontext.h | 3 + lib/config/defaults.h | 1 + lib/format_text/export.c | 29 +- lib/format_text/flags.c | 2 + lib/format_text/text_export.h | 6 + lib/metadata/lv_manip.c | 10 + lib/metadata/merge.c | 14 + lib/metadata/metadata-exported.h | 112 +++++- lib/metadata/metadata.c | 67 +++ lib/metadata/replicator_manip.c | 350 ++++++++++++++++ lib/metadata/segtype.h | 10 +- lib/mirror/mirrored.c | 4 +- lib/misc/configure.h.in | 8 +- lib/replicator/.exported_symbols | 1 + lib/replicator/Makefile.in | 28 ++ lib/replicator/replicator.c | 820 ++++++++++++++++++++++++++++++++++++++ lib/striped/striped.c | 4 +- libdm/.exported_symbols | 3 + libdm/libdevmapper.h | 29 ++ libdm/libdm-deptree.c | 348 ++++++++++++++++- tools/args.h | 5 + tools/commands.h | 10 +- tools/lvcreate.c | 47 +++ tools/lvmcmdline.c | 9 + tools/toollib.c | 95 ++++- tools/tools.h | 1 + tools/vgchange.c | 15 +- 32 files changed, 2200 insertions(+), 68 deletions(-) create mode 100644 lib/metadata/replicator_manip.c create mode 100644 lib/replicator/.exported_symbols create mode 100644 lib/replicator/Makefile.in create mode 100644 lib/replicator/replicator.c
PATCH 1/23 Indent changes
--- lib/activate/dev_manager.c | 4 ++-- libdm/libdm-deptree.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
lib/activate/dev_manager.c +2 -2
@@ -783,7 +783,7 @@ static char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,sprintf (errid,"missing_%d_%d" , segno, s); -if (!(id =build_dlid (dm, seg->lv->lvid.s, errid))) +if (!(id =build_dlid (dm, seg->lv->lvid.s, errid))) return_NULL; if (!(name = build_dm_name(dm->mem, seg->lv->vg->name,
@@ -1269,7 +1269,7 @@ static int _tree_action(struct dev_manager *dm, struct logical_volume *lv, actiodefault :log_error ("_tree_action: Action %u not supported." , action); goto out; - } + } r =1 ;
libdm/libdm-deptree.c +4 -4
@@ -645,7 +645,7 @@ struct dm_tree_node *dm_tree_add_new_dev_with_udev_flags(struct dm_tree *dtree,void dm_tree_node_set_read_ahead (struct dm_tree_node *dnode,uint32_t read_ahead,uint32_t read_ahead_flags) -{ +{ dnode->props.read_ahead = read_ahead; dnode->props.read_ahead_flags = read_ahead_flags; }
@@ -1064,8 +1064,8 @@ void dm_tree_use_no_flush_suspend(struct dm_tree_node *dnode) }int dm_tree_suspend_children (struct dm_tree_node *dnode, -const char *uuid_prefix, -size_t uuid_prefix_len) +const char *uuid_prefix, +size_t uuid_prefix_len) {void *handle =NULL ;struct dm_tree_node *child = dnode;
@@ -1849,7 +1849,7 @@ int dm_tree_node_add_crypt_target(struct dm_tree_node *node,int dm_tree_node_add_mirror_target_log (struct dm_tree_node *node,uint32_t region_size, -unsigned clustered, +unsigned clustered,const char *log_uuid,unsigned area_count,uint32_t flags)
Signature · 1 line
1.6.5.3
PATCH 2/23 Skip cast of void* for assigment
--- lib/activate/dev_manager.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/activate/dev_manager.c +1 -1
@@ -1095,7 +1095,7 @@ static int _create_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *rootint r =1 ;while ((child =dm_tree_next_child (&handle, root,0 ))) { -if (!(lvlayer = (struct lv_layer *)dm_tree_node_get_context (child))) +if (!(lvlayer =dm_tree_node_get_context (child)))continue ;/* Detect rename */
Signature · 1 line
1.6.5.3
PATCH 3/23 Simple indent changes to fit 80 chars per line
--- lib/activate/dev_manager.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
lib/activate/dev_manager.c +4 -2
@@ -971,7 +971,8 @@ static int _add_segment_to_dtree(struct dev_manager *dm,/* Add any LVs used by this segment */ for (s =0 ; s < seg->area_count; s++)if ((seg_type (seg, s) ==AREA_LV ) && - (!_add_new_lv_to_dtree (dm, dtree,seg_lv (seg, s),NULL ))) + (!_add_new_lv_to_dtree (dm, dtree,seg_lv (seg, s), +NULL ))) return_0; }
@@ -1018,7 +1019,8 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,return 1 ;if (!(lvlayer =dm_pool_alloc (dm->mem,sizeof (*lvlayer)))) { -log_error ("_add_new_lv_to_dtree: pool alloc failed for %s %s." , lv->name, layer); +log_error ("_add_new_lv_to_dtree: pool alloc failed for %s %s." , + lv->name, layer);return 0 ; }
Signature · 1 line
1.6.5.3
PATCH 4/23 Export outsz() and outhnt() for modules
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()
--- lib/format_text/export.c | 23 +++++++++-------------- lib/format_text/text_export.h | 2 ++ 2 files changed, 11 insertions(+), 14 deletions(-)
lib/format_text/export.c +9 -14
@@ -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);
lib/format_text/text_export.h +2 -0
@@ -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)
Signature · 1 line
1.6.5.3
PATCH 5/23 Export outfc() macro and out_text_with_comment()
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().
--- lib/format_text/export.c | 6 +++--- lib/format_text/text_export.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
lib/format_text/export.c +3 -3
@@ -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 */
lib/format_text/text_export.h +4 -0
@@ -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);
Signature · 1 line
1.6.5.3
PATCH 6/23 Use outsz macro
Using outsz() macro instead of direct call of out_size() with check for error status of this function.
--- lib/mirror/mirrored.c | 4 ++-- lib/striped/striped.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
lib/mirror/mirrored.c +2 -2
@@ -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)
lib/striped/striped.c +2 -2
@@ -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" ); }
Signature · 1 line
1.6.5.3
PATCH 7/23 Replicator: add libdm support
Introducing dm_tree_node_add_replicator_target() and dm_tree_node_add_replicator_dev_target().
--- libdm/.exported_symbols | 2 + libdm/libdevmapper.h | 27 +++++ libdm/libdm-deptree.c | 275 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 299 insertions(+), 5 deletions(-)
libdm/.exported_symbols +2 -0
@@ -78,6 +78,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
libdm/libdevmapper.h +27 -0
@@ -431,6 +431,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,
libdm/libdm-deptree.c +270 -5
358 lines not on this page · raw message
Signature · 1 line
1.6.5.3
PATCH 8/23 Replicator: suspend/deactivate replicator
Introducing dm_tree_set_replicator_suspend() to suspend replicator control device before actual deactivation of replicator-dev head device.
--- libdm/.exported_symbols | 1 + libdm/libdevmapper.h | 2 + libdm/libdm-deptree.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 0 deletions(-)
libdm/.exported_symbols +1 -0
@@ -80,6 +80,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
libdm/libdevmapper.h +2 -0
@@ -458,6 +458,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,
libdm/libdm-deptree.c +63 -0
87 lines not on this page · raw message
Signature · 1 line
1.6.5.3
PATCH 9/23 Replicator: add lvm support
Adding configure.in support for Replicator. Adding basic lib lvm support for Replicator. Adding flags REPLICATOR and REPLICATOR_LOG. Adding segments SEG_REPLICATOR and SEG_REPLICATOR_DEV.
--- configure.in | 17 + lib/Makefile.in | 9 + lib/commands/toolcontext.c | 5 + lib/format_text/flags.c | 2 + lib/metadata/lv_manip.c | 1 + lib/metadata/merge.c | 14 + lib/metadata/metadata-exported.h | 95 +++++- lib/metadata/replicator_manip.c | 309 ++++++++++++++ lib/metadata/segtype.h | 8 + lib/replicator/.exported_symbols | 1 + lib/replicator/Makefile.in | 28 ++ lib/replicator/replicator.c | 820 ++++++++++++++++++++++++++++++++++++++ 12 files changed, 1308 insertions(+), 1 deletions(-) create mode 100644 lib/metadata/replicator_manip.c create mode 100644 lib/replicator/.exported_symbols create mode 100644 lib/replicator/Makefile.in create mode 100644 lib/replicator/replicator.c
configure.in +17 -0
@@ -306,6 +306,21 @@ if test x$MIRRORS = xinternal; then fi ################################################################################ +dnl -- Asynchronous Volume Replicator inclusion type +AC_MSG_CHECKING(whether to include replicator) +AC_ARG_WITH(replicator, AC_HELP_STRING([--with-replicator=TYPE], + [Replicator support: internal/shared/none [[TYPE=none]]]), + [ REPLICATOR="$withval" ], [ REPLICATOR="none" ]) +AC_MSG_RESULT($REPLICATOR) + +case "$REPLICATOR" in + none|shared) ;; + internal) AC_DEFINE([REPLICATOR_INTERNAL], 1, + [Define to 1 to include built-in support for replicator.]) ;; + *) AC_MSG_ERROR([--with-replicator parameter invalid ($REPLICATOR)]) ;; +esac + +################################################################################ dnl -- Disable readline AC_MSG_CHECKING(whether to enable readline) AC_ARG_ENABLE([readline],
@@ -1115,6 +1130,7 @@ AC_SUBST(LVM_PATCHLEVEL) AC_SUBST(LVM_RELEASE) AC_SUBST(LVM_RELEASE_DATE) AC_SUBST(MIRRORS) +AC_SUBST(REPLICATOR) AC_SUBST(MSGFMT) AC_SUBST(OWNER) AC_SUBST(PKGCONFIG)
@@ -1163,6 +1179,7 @@ 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
lib/Makefile.in +9 -0
@@ -33,6 +33,10 @@ ifeq ("@MIRRORS@", "shared") SUBDIRS += mirror endif +ifeq ("@REPLICATOR@", "shared") + SUBDIRS += replicator +endif + SOURCES =\ activate/activate.c \ cache/lvmcache.c \
@@ -75,6 +79,7 @@ SOURCES =\ metadata/mirror.c \ metadata/pv_manip.c \ metadata/pv_map.c \ + metadata/replicator_manip.c \ metadata/segtype.c \ metadata/snapshot_manip.c \ misc/crc.c \
@@ -130,6 +135,10 @@ ifeq ("@MIRRORS@", "internal") SOURCES += mirror/mirrored.c endif +ifeq ("@REPLICATOR@", "internal") + SOURCES += replicator/replicator.c +endif + ifeq ("@DEVMAPPER@", "yes") SOURCES +=\ activate/dev_manager.c \
lib/commands/toolcontext.c +5 -0
@@ -904,6 +904,11 @@ static int _init_segtypes(struct cmd_context *cmd)dm_list_add (&cmd->segtypes, &segtype->list);#endif +#ifdef REPLICATOR_INTERNAL +if (!init_replicator_segtype (&seglib)) +return 0 ; +#endif +#ifdef HAVE_LIBDL /* Load any formats in shared libs unless static */ if (!is_static() &&
lib/format_text/flags.c +2 -0
@@ -66,6 +66,8 @@ static struct flag _lv_flags[] = { {PARTIAL_LV, NULL, 0}, {POSTORDER_FLAG, NULL, 0}, {VIRTUAL_ORIGIN, NULL, 0}, + {REPLICATOR, NULL, 0}, + {REPLICATOR_LOG, NULL, 0}, {0, NULL, 0} };
lib/metadata/lv_manip.c +1 -0
@@ -1876,6 +1876,7 @@ struct logical_volume *alloc_lv(struct dm_pool *mem)dm_list_init (&lv->segments);dm_list_init (&lv->tags);dm_list_init (&lv->segs_using_this_lv); +dm_list_init (&lv->rsites);return lv; }
lib/metadata/merge.c +14 -0
@@ -66,6 +66,8 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)int r =1 ;uint32_t area_multiplier, s;struct seg_list *sl; +struct replicator_site *rsite; +struct replicator_device *rdev; dm_list_iterate_items(seg, &lv->segments) { seg_count++;
@@ -207,6 +209,18 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)if (lv ==seg_lv (seg, s)) seg_found++; } +if (seg_is_replicator_dev (seg)) { + dm_list_iterate_items(rsite, &seg->replicator->rsites) { + dm_list_iterate_items(rdev, &rsite->rdevices) { +if (lv == rdev->lv || lv == rdev->slog) + seg_found++; + } + } +if (lv == seg->replicator) + seg_found++; + } +if (seg_is_replicator (seg) && lv == seg->rlog_lv) + seg_found++;if (seg->log_lv == lv) seg_found++;if (!seg_found) {
lib/metadata/metadata-exported.h +94 -1
131 lines not on this page · raw message
lib/metadata/replicator_manip.c new file +309 -0
309 lines not on this page · raw message
lib/metadata/segtype.h +8 -0
@@ -36,8 +36,12 @@ struct dev_manager;#define SEG_CANNOT_BE_ZEROED 0x00000040U#define SEG_MONITORED 0x00000080U#define SEG_UNKNOWN 0x80000000U +#define SEG_REPLICATOR 0x00000100U +#define SEG_REPLICATOR_DEV 0x00000200U#define seg_is_mirrored (seg) ((seg)->segtype->flags & SEG_AREAS_MIRRORED ? 1 : 0) +#define seg_is_replicator (seg) ((seg)->segtype->flags & SEG_REPLICATOR ? 1 : 0) +#define seg_is_replicator_dev (seg) ((seg)->segtype->flags & SEG_REPLICATOR_DEV ? 1 : 0)#define seg_is_striped (seg) ((seg)->segtype->flags & SEG_AREAS_STRIPED ? 1 : 0)#define seg_is_snapshot (seg) ((seg)->segtype->flags & SEG_SNAPSHOT ? 1 : 0)#define seg_is_virtual (seg) ((seg)->segtype->flags & SEG_VIRTUAL ? 1 : 0)
@@ -109,6 +113,10 @@ struct segment_type *init_error_segtype(struct cmd_context *cmd);struct segment_type *init_free_segtype (struct cmd_context *cmd);struct segment_type *init_unknown_segtype (struct cmd_context *cmd,const char *name); +#ifdef REPLICATOR_INTERNAL +int init_replicator_segtype (struct segtype_library *seglib); +#endif +#ifdef SNAPSHOT_INTERNAL struct segment_type *init_snapshot_segtype (struct cmd_context *cmd);#endif
lib/replicator/.exported_symbols new file +1 -0
@@ -0,0 +1 @@ +init_segtype
lib/replicator/Makefile.in new file +28 -0
@@ -0,0 +1,28 @@ +# +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +SOURCES = replicator.c + +LIB_SHARED = liblvm2replicator.so + +include $(top_srcdir)/make.tmpl + +install: $(LIB_SHARED) + $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \ + $(libdir)/$(LIB_SHARED).$(LIB_VERSION) + $(LN_S) -f $(LIB_SHARED).$(LIB_VERSION) \ + $(libdir)/$(LIB_SHARED)
lib/replicator/replicator.c new file +820 -0
820 lines not on this page · raw message
Signature · 1 line
1.6.5.3
PATCH 10/23 Replicator: validation of replicator segments
Validate segments with Replicator content
--- lib/metadata/metadata.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
lib/metadata/metadata.c +63 -0
@@ -2088,6 +2088,66 @@ 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) +{ +const struct replicator_site *rsite, *rsiteb; +const 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 ; +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 +2248,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) {
Signature · 1 line
1.6.5.3
PATCH 11/23 Replicator: extend _lv_each_dependency() rep. deps
--- lib/metadata/metadata.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
lib/metadata/metadata.c +4 -0
@@ -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;
Signature · 1 line
1.6.5.3
PATCH 12/23 Replicator: add sorted vg_name_list
Introduce vg_name_list structure to keep information about needed volume group name and the actual pointer to opened VG.
VG must be opened in alphabetical order, thus elements in the list are being kept ordered all the time.
Two funtions extends dm_list vg_name_list_add(), vg_name_list_lookup().
--- lib/metadata/metadata-exported.h | 16 ++++++++++++++ lib/metadata/replicator_manip.c | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 0 deletions(-)
lib/metadata/metadata-exported.h +16 -0
@@ -281,6 +281,14 @@ struct lv_segment_area {struct segment_type ; +/* List with VG names +* similar to str_list with one extra pointer */ +struct vg_name_list { +struct dm_list list; +const char *name; +struct volume_group *vg; +}; +/* ++ replicator datatypes */ typedef enum { REPLICATOR_ACTION_WARN,
@@ -778,6 +786,14 @@ int lv_is_slog(const struct logical_volume *lv);/* return first replicator_dev in site in case the lv is replicator-dev, NULL otherwise */ struct logical_volume *first_replicator_dev (const struct logical_volume *lv);/* -- metadata/replicator_manip.c */ +/* +* maintain the alphabeticaly ordered list, avoid duplications +* return either newly created or already present vg_name_list entry +*/ +struct vg_name_list *vg_name_list_add (struct dm_pool *mem,struct dm_list *,const char *name); +/* find element with given name in vg_name_list list */ +struct vg_name_list *vg_name_list_lookup (struct dm_list *,const char *name); +struct logical_volume *find_pvmove_lv (struct volume_group *vg,struct device *dev,uint32_t lv_type);
lib/metadata/replicator_manip.c +41 -0
44 lines not on this page · raw message
Signature · 1 line
1.6.5.3
PATCH 13/23 Replicator: use vg_name_list for _process_one_vg()
Use list of sorted VG names from cmd_context structure.
Patch modifes behavior of _process_one_vg() by handling error case from vg_read() immeditaly and not in the 'out:' path.
For the first pass plain vg_read() for the given name is used. Replicator collects sorted list of required VG names in this run. If any of them is not yet opened next loop is taken with alphabetically opened VGs. VGs are released in reversed order from their open order.
Extra flag vgs_missed is used to detect state, when some of VGs are missing.
CHECKME: flags for external VGs could be probably different.
memory release from cmd_context list.
--- lib/commands/toolcontext.h | 2 + tools/toollib.c | 88 +++++++++++++++++++++++++++++++++----------- 2 files changed, 68 insertions(+), 22 deletions(-)
lib/commands/toolcontext.h +2 -0
@@ -60,6 +60,8 @@ struct cmd_context {struct dm_list formats;/* Available formats */ struct dm_list segtypes;/* Available segment types */ +struct dm_list vgs_list;/* Required read-only VGs */ +int vgs_missed;/* Missed VGs */ const char *hostname;const char *kernel_vsn;
tools/toollib.c +66 -22
102 lines not on this page · raw message
Signature · 1 line
1.6.5.3
PATCH 14/23 Replicator: update _create_partial_dtree()
Creating partial tree for Replicator target.
Using dm_tree_set_priority() to set higher priority for Replicator.
--- lib/activate/dev_manager.c | 98 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+), 0 deletions(-)
lib/activate/dev_manager.c +98 -0
@@ -725,6 +725,98 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, strucreturn 1 ; } +/* +* Add devices from replicator +* use _add_dev_to_dtree() directly instead of _add_lv_to_dtree() +* no need to extend its check with _slog, _rlog, _rimage +*/ +static int _create_partial_replicator (struct dev_manager *dm, +struct dm_tree *dtree, +struct lv_segment *seg) +{ +struct replicator_device *rdev; +struct replicator_site *rsite; +struct vg_name_list *vnl; +const char *replicator_dlid; +int vg_missing =0 ; + +if (!lv_is_active_replicator_dev (seg->lv)) { +if (!_add_dev_to_dtree (dm, dtree, seg->lv->rdevice->lv, +NULL )) + return_0; +return 1 ; + } + +/* check needed VGs */ + dm_list_iterate_items(rsite, &seg->replicator->rsites) { +if (!rsite->vg_name) +continue ; + +if (!(vnl =vg_name_list_add (dm->cmd->mem, &dm->cmd->vgs_list, + rsite->vg_name))) + return_0; + +if ((rsite->vg = vnl->vg)) +continue ; + + vg_missing++; +log_verbose ("VG %s added as missing." , rsite->vg_name); + } + +if (vg_missing) { + dm->cmd->vgs_missed++; +log_very_verbose ("Some VGs are missing, retry with them." ); +return 0 ; + } + +/* Add all related devs for replicator */ + dm_list_iterate_items(rsite, &seg->replicator->rsites) { + dm_list_iterate_items(rdev, &rsite->rdevices) { +if (rsite->state ==REPLICATOR_STATE_ACTIVE ) { +/* Add _rimage LV */ +if (rdev->lv && + !_add_dev_to_dtree (dm, dtree, + rdev->lv,NULL )) + return_0; + +/* Add replicator-dev LV */ +if (seg->lv != rdev->replicator_dev->lv && + !_add_dev_to_dtree (dm, dtree, + rdev->replicator_dev->lv, +NULL )) + return_0; + } + +/* Add _slog LV */ +if (rdev->slog && + !_add_dev_to_dtree (dm, dtree, rdev->slog,NULL )) + return_0; + +/* Resolve and add remote LV */ +if (rdev->rsite->vg && rdev->name && + (!(rdev->lv =find_lv (rdev->rsite->vg, rdev->name)) || + !_add_dev_to_dtree (dm, dtree, rdev->lv,NULL ))) + return_0; + } + } + +/* Add rlog and replicator devices */ +if (first_seg (seg->replicator)->rlog_lv && + !_add_dev_to_dtree (dm, dtree,first_seg (seg->replicator)->rlog_lv, +NULL )) + return_0; +if (!_add_dev_to_dtree (dm, dtree, seg->replicator,NULL )) + return_0; + +/* Set suspend priority for replicator device */ +if (!(replicator_dlid =build_dlid (dm, seg->replicator->lvid.s,NULL ))) + return_0; +if (!dm_tree_set_replicator_suspend (dtree, replicator_dlid)) + return_0; + +return 1 ; +} +static struct dm_tree *_create_partial_dtree (struct dev_manager *dm,struct logical_volume *lv) {struct dm_tree *dtree;
@@ -745,6 +837,12 @@ static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logi if (!_add_lv_to_dtree(dm, dtree, dm_list_struct_base(snh, struct lv_segment, origin_list)->cow)) goto_bad; +/* Add any replicator-dev LVs of this LV */ + dm_list_iterate_items(seg, &lv->segments) +if (seg_is_replicator_dev (seg) && + !_create_partial_replicator (dm, dtree, seg)) + goto_bad; +/* Add any LVs used by segments in this LV */ dm_list_iterate_items(seg, &lv->segments)for (s =0 ; s < seg->area_count; s++)
Signature · 1 line
1.6.5.3
PATCH 15/23 Replicator: using vgs_missed for error count
Lower expected_count for the case of missed VGs so no error is printed in case the remote VGs are not opened. Currently it's needed only for Replicator target.
--- tools/vgchange.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
tools/vgchange.c +1 -0
@@ -102,6 +102,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, count++; } + expected_count -= cmd->vgs_missed;if (expected_count) log_verbose("%s %d logical volumes in volume group %s", activate ? "Activated" : "Deactivated",
Signature · 1 line
1.6.5.3
PATCH 16/23 Replicator: add vgs_print for message postponing
For replicator we introduce multiple runs over the same function. In the first step some error prints could be generated, because not all resources were available. Such message could be postponed so usually only the last message gets printed.
--- lib/commands/toolcontext.h | 1 + tools/toollib.c | 7 +++++++ tools/vgchange.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-)
lib/commands/toolcontext.h +1 -0
@@ -62,6 +62,7 @@ struct cmd_context {struct dm_list segtypes;/* Available segment types */ struct dm_list vgs_list;/* Required read-only VGs */ int vgs_missed;/* Missed VGs */ +char *vgs_print;/* Error case print */ const char *hostname;const char *kernel_vsn;
tools/toollib.c +7 -0
@@ -490,6 +490,13 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, } } out: +if (cmd->vgs_print) { +/* postponed print */ +log_print ("%s" , cmd->vgs_print); +dm_free (cmd->vgs_print); + cmd->vgs_print =NULL ; + } + dm_list_iterate_back_items(vnl, &cmd->vgs_list)if (vnl->vg) {unlock_and_release_vg (cmd, vnl->vg, vnl->name);
tools/vgchange.c +8 -2
@@ -168,8 +168,14 @@ static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg) ret =_activate_lvs_in_vg (cmd, vg, available); -log_print ("%d logical volume(s) in volume group \"%s\" now active" , -lvs_in_vg_activated (vg), vg->name); +/* postpone print */ +dm_free (cmd->vgs_print); +if (dm_asprintf (&cmd->vgs_print, +"%d logical volume(s) in volume group \"%s\" now active" , +lvs_in_vg_activated (vg), vg->name) <0 ) { + cmd->vgs_print =NULL ; + } +return ret; }
Signature · 1 line
1.6.5.3
PATCH 17/23 Replicator: add replicator to dtree
Adding all replicator related LVs to dtree.
Start of one replicator_dev initiate start of all other related.
--- lib/activate/dev_manager.c | 60 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 1 deletions(-)
lib/activate/dev_manager.c +59 -1
@@ -1024,6 +1024,58 @@ 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) +{ +const struct replicator_device *rdev; +struct replicator_site *rsite; + +/* only active replicator */ +if (!lv_is_active_replicator_dev (seg->lv)) { +if (!_add_new_lv_to_dtree (dm, dtree, seg->lv->rdevice->lv,NULL )) + return_0; +return 1 ; + } + +/* 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->lv ||/* resolved in _partial */ + !_add_new_lv_to_dtree (dm, dtree, + rdev->lv,NULL )) + return_0; + +if (rdev->slog && + !_add_new_lv_to_dtree (dm, dtree, + rdev->slog,NULL )) + return_0; + } + } +/* add remaining replicator-dev nodes in the second loop +* to avoid multiple retries for inserting all elements */ + 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; + } + } + +return 1 ; +} + static int _add_segment_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, struct dm_tree_node *dnode,
@@ -1054,8 +1106,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 ;
Signature · 1 line
1.6.5.3
PATCH 18/23 Replicator: do not remove of replicators' LVs
--- lib/metadata/lv_manip.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
lib/metadata/lv_manip.c +9 -0
@@ -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 ;
Signature · 1 line
1.6.5.3
PATCH 19/23 Replicator: activate change for vgchange
Activate only the first replicator-dev LV, that activates all other related LVs from Replicator.
--- tools/vgchange.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
tools/vgchange.c +4 -0
@@ -72,6 +72,10 @@ 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_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)) &&
Signature · 1 line
1.6.5.3
PATCH 20/23 Replicator: add new options for replicator
New options: addsite, delsite, replicator,
replicatorlog, replicatorlogtype.
--- 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(-)
lib/config/defaults.h +1 -0
@@ -104,6 +104,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
lib/metadata/metadata-exported.h +1 -0
@@ -592,6 +592,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 */
tools/args.h +5 -0
@@ -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 )
tools/commands.h +8 -2
@@ -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)
tools/lvcreate.c +47 -0
65 lines not on this page · raw message
tools/lvmcmdline.c +9 -0
@@ -480,6 +480,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))) {
tools/tools.h +1 -0
@@ -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 arg_count (const struct cmd_context *cmd,int a);
Signature · 1 line
1.6.5.3
PATCH 21/23 Replicator: update copyright dates
--- lib/activate/dev_manager.c | 2 +- lib/metadata/segtype.h | 2 +- libdm/libdm-deptree.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
lib/activate/dev_manager.c +1 -1
@@ -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. *
lib/metadata/segtype.h +1 -1
@@ -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. *
libdm/libdm-deptree.c +1 -1
@@ -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. *
Signature · 1 line
1.6.5.3
PATCH 22/23 Replicator: new variable in generated file
--- lib/misc/configure.h.in | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
lib/misc/configure.h.in +7 -1
@@ -273,7 +273,7 @@ /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL -/* Define to 1 if `st_rdev' is member of `struct stat'. */ +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_RDEV /* Define to 1 if you have the <syslog.h> header file. */
@@ -410,6 +410,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION
@@ -419,6 +422,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
Signature · 1 line
1.6.5.3
PATCH 23/23 Replicator: update of generated configure file
--- configure | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-)
configure +33 -1
@@ -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" ;;
Signature · 1 line
1.6.5.3
PATCH 4/23 Export outsz() and outhnt() for modules
In reply to Zdenek Kabelaclib/format_text/text_export.h line 22
Quoted 7 lines · Zdenek Kabelac
Adding macro
outsz()forout_size()andouthnt()forout_hint()that checks for error in a similar way asoutf()does forout_text()lib/format_text/text_export.h +2
-0+#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)
But outsz and outhnt are ugly, so if we can't think of better names, let's at least add another patch to swap over all 4 names so the exported versions are the 'nice' ones.
#define out_newline(f) do {if (!outnl(f)) return_0;} while (0)
Alasdair
cover Replicator lvm support
In reply to Zdenek KabelacQuoted 4 lines · Zdenek Kabelac
Set of patches to introduce LVM support for dm target replicator. Patches without Replicator: prefix are generic simple patches or some minor code cleanups - they are here just to get accurate diffs.
Ack to the first 6 - reviewed them and compiled.
I have been looking at the other LVM patches.
I will probably skip over the dm stuff for now and focus on those.