mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Rename register_dev; fix missing initialisation; reduce number of ifdefs.
This commit is contained in:
parent
c507b684ce
commit
ed09d7e394
@ -574,11 +574,10 @@ int lvs_in_vg_opened(struct volume_group *vg)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DMEVENTD
|
static int _register_dev_for_events(struct cmd_context *cmd,
|
||||||
static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
|
struct logical_volume *lv, int do_reg)
|
||||||
int do_reg)
|
|
||||||
{
|
{
|
||||||
|
#ifdef DMEVENTD
|
||||||
struct list *tmp;
|
struct list *tmp;
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
int (*reg) (struct dm_pool *mem, struct lv_segment *,
|
int (*reg) (struct dm_pool *mem, struct lv_segment *,
|
||||||
@ -587,6 +586,8 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
list_iterate(tmp, &lv->segments) {
|
list_iterate(tmp, &lv->segments) {
|
||||||
seg = list_item(tmp, struct lv_segment);
|
seg = list_item(tmp, struct lv_segment);
|
||||||
|
|
||||||
|
reg = NULL;
|
||||||
|
|
||||||
if (do_reg) {
|
if (do_reg) {
|
||||||
if (seg->segtype->ops->target_register_events)
|
if (seg->segtype->ops->target_register_events)
|
||||||
reg = seg->segtype->ops->target_register_events;
|
reg = seg->segtype->ops->target_register_events;
|
||||||
@ -601,9 +602,9 @@ static int _register_dev(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
||||||
int error_if_not_suspended)
|
int error_if_not_suspended)
|
||||||
@ -637,9 +638,9 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DMEVENTD
|
if (!_register_dev_for_events(cmd, lv, 0))
|
||||||
_register_dev(cmd, lv, 0);
|
stack;
|
||||||
#endif
|
|
||||||
memlock_inc();
|
memlock_inc();
|
||||||
if (!_lv_suspend_lv(lv)) {
|
if (!_lv_suspend_lv(lv)) {
|
||||||
memlock_dec();
|
memlock_dec();
|
||||||
@ -690,9 +691,8 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
memlock_dec();
|
memlock_dec();
|
||||||
fs_unlock();
|
fs_unlock();
|
||||||
|
|
||||||
#ifdef DMEVENTD
|
if (!_register_dev_for_events(cmd, lv, 1))
|
||||||
_register_dev(cmd, lv, 1);
|
stack;
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -737,9 +737,8 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DMEVENTD
|
if (!_register_dev_for_events(cmd, lv, 0))
|
||||||
_register_dev(cmd, lv, 0);
|
stack;
|
||||||
#endif
|
|
||||||
|
|
||||||
memlock_inc();
|
memlock_inc();
|
||||||
r = _lv_deactivate(lv);
|
r = _lv_deactivate(lv);
|
||||||
@ -811,9 +810,8 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
memlock_dec();
|
memlock_dec();
|
||||||
fs_unlock();
|
fs_unlock();
|
||||||
|
|
||||||
#ifdef DMEVENTD
|
if (!_register_dev_for_events(cmd, lv, 1))
|
||||||
_register_dev(cmd, lv, 1);
|
stack;
|
||||||
#endif
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user