return count;
}
-#ifdef DMEVENTD
-static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
- int do_reg)
+static int _register_dev_for_events(struct cmd_context *cmd,
+ struct logical_volume *lv, int do_reg)
{
-
+#ifdef DMEVENTD
struct list *tmp;
struct lv_segment *seg;
int (*reg) (struct dm_pool *mem, struct lv_segment *,
list_iterate(tmp, &lv->segments) {
seg = list_item(tmp, struct lv_segment);
+ reg = NULL;
+
if (do_reg) {
if (seg->segtype->ops->target_register_events)
reg = seg->segtype->ops->target_register_events;
}
}
+#endif
return 1;
}
-#endif
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
int error_if_not_suspended)
}
}
-#ifdef DMEVENTD
- _register_dev(cmd, lv, 0);
-#endif
+ if (!_register_dev_for_events(cmd, lv, 0))
+ stack;
+
memlock_inc();
if (!_lv_suspend_lv(lv)) {
memlock_dec();
memlock_dec();
fs_unlock();
-#ifdef DMEVENTD
- _register_dev(cmd, lv, 1);
-#endif
+ if (!_register_dev_for_events(cmd, lv, 1))
+ stack;
return 1;
}
return 0;
}
-#ifdef DMEVENTD
- _register_dev(cmd, lv, 0);
-#endif
+ if (!_register_dev_for_events(cmd, lv, 0))
+ stack;
memlock_inc();
r = _lv_deactivate(lv);
memlock_dec();
fs_unlock();
-#ifdef DMEVENTD
- _register_dev(cmd, lv, 1);
-#endif
+ if (!_register_dev_for_events(cmd, lv, 1))
+ stack;
return r;
}