poll_daemon is never called with name == NULL, so remove code that is executed in that case (that code polls the whole VG). It will make refactoring the polldaemon much easier. Signed-off-by: Mikulas Patocka --- tools/polldaemon.c | 59 +---------------------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) Index: LVM2.2.02.43/tools/polldaemon.c =================================================================== --- LVM2.2.02.43.orig/tools/polldaemon.c 2008-11-25 19:05:17.000000000 +0100 +++ LVM2.2.02.43/tools/polldaemon.c 2008-11-25 19:11:24.000000000 +0100 @@ -174,58 +174,6 @@ static int _wait_for_single_mirror(struc return 1; } -static int _poll_vg(struct cmd_context *cmd, const char *vgname, - struct volume_group *vg, int consistent, void *handle) -{ - struct daemon_parms *parms = (struct daemon_parms *) handle; - struct lv_list *lvl; - struct logical_volume *lv_mirr; - const char *name; - int finished; - - if (!vg) { - log_error("Couldn't read volume group %s", vgname); - return ECMD_FAILED; - } - - if (!consistent) { - log_error("Volume Group %s inconsistent - skipping", vgname); - /* FIXME Should we silently recover it here or not? */ - return ECMD_FAILED; - } - - if (!vg_check_status(vg, EXPORTED_VG)) - return ECMD_FAILED; - - dm_list_iterate_items(lvl, &vg->lvs) { - lv_mirr = lvl->lv; - if (!(lv_mirr->status & parms->lv_type)) - continue; - if (!(name = parms->poll_fns->get_copy_name_from_lv(lv_mirr))) - continue; - /* FIXME Need to do the activation from _set_up_pvmove here - * if it's not running and we're not aborting */ - if (_check_mirror_status(cmd, vg, lv_mirr, name, - parms, &finished) && !finished) - parms->outstanding_count++; - } - - return ECMD_PROCESSED; - -} - -static void _poll_for_all_vgs(struct cmd_context *cmd, - struct daemon_parms *parms) -{ - while (1) { - parms->outstanding_count = 0; - process_each_vg(cmd, 0, NULL, LCK_VG_WRITE, 1, parms, _poll_vg); - if (!parms->outstanding_count) - break; - sleep(parms->interval); - } -} - int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background, uint32_t lv_type, struct poll_functions *poll_fns, const char *progress_title) @@ -260,11 +208,8 @@ int poll_daemon(struct cmd_context *cmd, /* fork one daemon per copy? */ } - if (name) { - if (!_wait_for_single_mirror(cmd, name, &parms)) - return ECMD_FAILED; - } else - _poll_for_all_vgs(cmd, &parms); + if (!_wait_for_single_lv(cmd, name, &parms)) + return ECMD_FAILED; return ECMD_PROCESSED; }