summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2008-01-31 12:19:36 +0000
committerAlasdair Kergon <agk@redhat.com>2008-01-31 12:19:36 +0000
commit4e9083db106db41947c2eda15058f159b38aaf93 (patch)
tree3c4709f80605d6ede711c0d6a169feef8790d62a /lib
parent16e2a5aa3b7947af3f5ca85bc875b08a29b980f7 (diff)
downloadlvm2-4e9083db106db41947c2eda15058f159b38aaf93.tar.gz
lvm2-4e9083db106db41947c2eda15058f159b38aaf93.tar.xz
lvm2-4e9083db106db41947c2eda15058f159b38aaf93.zip
Fix mirror log name construction during lvconvert. (2.02.30)
Make monitor_dev_for_events recurse through the stack of LVs. Clean up some more compiler warnings. Add mirror names test script.
Diffstat (limited to 'lib')
-rw-r--r--lib/activate/activate.c14
-rw-r--r--lib/filters/filter-md.c3
-rw-r--r--lib/metadata/mirror.c33
-rw-r--r--lib/mirror/mirrored.c3
-rw-r--r--lib/report/report.c2
-rw-r--r--lib/snapshot/snapshot.c3
6 files changed, 48 insertions, 10 deletions
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 71d54f03..21b12542 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -679,6 +679,7 @@ int monitor_dev_for_events(struct cmd_context *cmd,
struct list *tmp, *snh, *snht;
struct lv_segment *seg;
int (*monitor_fn) (struct lv_segment *s, int e);
+ uint32_t s;
/* skip dmeventd code altogether */
if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
@@ -715,6 +716,19 @@ int monitor_dev_for_events(struct cmd_context *cmd,
list_iterate(tmp, &lv->segments) {
seg = list_item(tmp, struct lv_segment);
+ /* Recurse for AREA_LV */
+ for (s = 0; s < seg->area_count; s++) {
+ if (seg_type(seg, s) != AREA_LV)
+ continue;
+ if (!monitor_dev_for_events(cmd, seg_lv(seg, s),
+ monitor)) {
+ log_error("Failed to %smonitor %s",
+ monitor ? "" : "un",
+ seg_lv(seg, s)->name);
+ r = 0;
+ }
+ }
+
if (!seg_monitored(seg) || (seg->status & PVMOVE))
continue;
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index 26d0296c..c1ecff72 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -19,7 +19,8 @@
#ifdef linux
-static int _ignore_md(struct dev_filter *f, struct device *dev)
+static int _ignore_md(struct dev_filter *f __attribute((unused)),
+ struct device *dev)
{
int ret;
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 08fbccf8..2dac312d 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1182,7 +1182,7 @@ static struct logical_volume *_create_mirror_log(struct logical_volume *lv,
return NULL;
}
- if (dm_snprintf(log_name, len, "%s%s", lv->name, suffix) < 0) {
+ if (dm_snprintf(log_name, len, "%s%s", lv_name, suffix) < 0) {
log_error("log_name allocation failed.");
return NULL;
}
@@ -1207,7 +1207,9 @@ static struct logical_volume *_set_up_mirror_log(struct cmd_context *cmd,
int in_sync)
{
struct logical_volume *log_lv;
- const char *suffix;
+ const char *suffix, *c;
+ char *lv_name;
+ size_t len;
struct lv_segment *seg;
init_mirror_in_sync(in_sync);
@@ -1217,15 +1219,34 @@ static struct logical_volume *_set_up_mirror_log(struct cmd_context *cmd,
return NULL;
}
- /* Check if the log is for temporary sync layer. */
+ /* Mirror log name is lv_name + suffix, determined as the following:
+ * 1. suffix is:
+ * o "_mlog" for the original mirror LV.
+ * o "_mlogtmp_%d" for temporary mirror LV,
+ * 2. lv_name is:
+ * o lv->name, if the log is temporary
+ * o otherwise, the top-level LV name
+ */
seg = first_seg(lv);
if (seg_type(seg, 0) == AREA_LV &&
- strstr(seg_lv(seg, 0)->name, MIRROR_SYNC_LAYER))
+ strstr(seg_lv(seg, 0)->name, MIRROR_SYNC_LAYER)) {
+ lv_name = lv->name;
suffix = "_mlogtmp_%d";
- else
+ } else if ((c = strstr(lv->name, MIRROR_SYNC_LAYER))) {
+ len = c - lv->name + 1;
+ if (!(lv_name = alloca(len)) ||
+ !dm_snprintf(lv_name, len, "%s", lv->name)) {
+ log_error("mirror log name allocation failed");
+ return 0;
+ }
+ suffix = "_mlog";
+ } else {
+ lv_name = lv->name;
suffix = "_mlog";
+ }
- if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv->name, suffix))) {
+ if (!(log_lv = _create_mirror_log(lv, ah, alloc,
+ (const char *) lv_name, suffix))) {
log_error("Failed to create mirror log.");
return NULL;
}
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 1a7a8e31..48577e3d 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -456,7 +456,8 @@ static int _target_monitored(struct lv_segment *seg, int *pending)
}
/* FIXME This gets run while suspended and performs banned operations. */
-static int _target_set_events(struct lv_segment *seg, int evmask, int set)
+static int _target_set_events(struct lv_segment *seg,
+ int evmask __attribute((unused)), int set)
{
char *dso, *name;
struct logical_volume *lv;
diff --git a/lib/report/report.c b/lib/report/report.c
index ace48d07..7e1b6796 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1049,7 +1049,7 @@ static const struct dm_report_object_type _report_types[] = {
#define STR DM_REPORT_FIELD_TYPE_STRING
#define NUM DM_REPORT_FIELD_TYPE_NUMBER
-#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((void *)&_dummy._ ## strct.field - (void *)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
+#define FIELD(type, strct, sorttype, head, field, width, func, id, desc) {type, sorttype, (off_t)((uintptr_t)&_dummy._ ## strct.field - (uintptr_t)&_dummy._ ## strct), width, id, head, &_ ## func ## _disp, desc},
static struct dm_report_field_type _fields[] = {
#include "columns.h"
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index c8980be3..cb166f90 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -213,7 +213,8 @@ static int _target_registered(struct lv_segment *seg, int *pending)
}
/* FIXME This gets run while suspended and performs banned operations. */
-static int _target_set_events(struct lv_segment *seg, int events, int set)
+static int _target_set_events(struct lv_segment *seg,
+ int events __attribute((unused)), int set)
{
char *dso, *name;
struct volume_group *vg = seg->lv->vg;