diff options
author | Ondrej Kozina <okozina@redhat.com> | 2015-03-31 14:24:31 +0200 |
---|---|---|
committer | Ondrej Kozina <okozina@redhat.com> | 2015-04-01 11:01:23 +0200 |
commit | c0a39ec53f99b1d1942488186e20c4f79f26412f (patch) | |
tree | eb552ed1a4d1d397c7d72eec1d5eeb2965b15858 | |
parent | 4fae05f06c8468df1c36b515938361c801890ad2 (diff) | |
download | lvm2-c0a39ec53f99b1d1942488186e20c4f79f26412f.tar.gz |
polldaemon: few fixes regarding the pvmove/pvmove --abort fixes
-rw-r--r-- | tools/polldaemon.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/tools/polldaemon.c b/tools/polldaemon.c index 6853c592a..b4952b79f 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -369,14 +369,9 @@ static void _poll_for_all_vgs(struct cmd_context *cmd, } #ifdef LVMPOLLD_SUPPORT -struct poll_lv_list { - struct dm_list list; - struct poll_operation_id *id; -}; - typedef struct { struct daemon_parms *parms; - struct dm_list plvs; + struct dm_list idls; } lvmpolld_parms_t; static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id, @@ -429,7 +424,7 @@ static int _lvmpolld_init_poll_vg(struct cmd_context *cmd, const char *vgname, int r; struct lv_list *lvl; struct logical_volume *lv; - struct poll_lv_list *plv; + struct poll_id_list *idl; struct poll_operation_id id; lvmpolld_parms_t *lpdp = (lvmpolld_parms_t *) handle->custom_handle; @@ -454,17 +449,10 @@ static int _lvmpolld_init_poll_vg(struct cmd_context *cmd, const char *vgname, r = lvmpolld_poll_init(cmd, &id, lpdp->parms); if (r && !lpdp->parms->background) { - plv = (struct poll_lv_list *) dm_malloc(sizeof(struct poll_lv_list)); - if (!plv) + if (!(idl = poll_id_list_create(cmd->mem, &id))) return ECMD_FAILED; - plv->id = copy_poll_operation_id(&id); - if (!plv->id) { - dm_free(plv); - return ECMD_FAILED; - } - - dm_list_add(&lpdp->plvs, &plv->list); + dm_list_add(&lpdp->idls, &idl->list); } } @@ -476,33 +464,36 @@ static void _lvmpolld_poll_for_all_vgs(struct cmd_context *cmd, struct processing_handle *handle) { int r; - struct poll_lv_list *plv, *tlv; + struct dm_list *first; + struct poll_id_list *idl, *tlv; unsigned finished; lvmpolld_parms_t lpdp = { .parms = parms }; - dm_list_init(&lpdp.plvs); + dm_list_init(&lpdp.idls); handle->custom_handle = &lpdp; process_each_vg(cmd, 0, NULL, 0, handle, _lvmpolld_init_poll_vg); - while (!dm_list_empty(&lpdp.plvs)) { - dm_list_iterate_items_safe(plv, tlv, &lpdp.plvs) { - r = lvmpolld_request_info(plv->id, lpdp.parms, + first = dm_list_first(&lpdp.idls); + + while (!dm_list_empty(&lpdp.idls)) { + dm_list_iterate_items_safe(idl, tlv, &lpdp.idls) { + r = lvmpolld_request_info(idl->id, lpdp.parms, &finished); - if (!r || finished) { - dm_list_del(&plv->list); - destroy_poll_operation_id(plv->id); - dm_free(plv); - } + if (!r || finished) + dm_list_del(&idl->list); else - report_progress(cmd, plv->id, lpdp.parms); + report_progress(cmd, idl->id, lpdp.parms); } _nanosleep(lpdp.parms->interval, 0); } + + if (first) + dm_pool_free(cmd->mem, dm_list_item(first, struct poll_id_list)); } static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id, |