mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
lvconvert: simplify handler processing
Easier code for handler init. Drop release of pool mem - not needed, as command pool get dropped just later.
This commit is contained in:
parent
abd9618dd8
commit
86a651854f
@ -3503,15 +3503,13 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
|
|||||||
struct convert_poll_id_list *idl;
|
struct convert_poll_id_list *idl;
|
||||||
struct lvconvert_params lp = {
|
struct lvconvert_params lp = {
|
||||||
.target_attr = ~0,
|
.target_attr = ~0,
|
||||||
|
.idls = DM_LIST_HEAD_INIT(lp.idls),
|
||||||
};
|
};
|
||||||
struct processing_handle *handle = NULL;
|
struct processing_handle *handle = init_processing_handle(cmd);
|
||||||
|
|
||||||
dm_list_init(&lp.idls);
|
if (!handle) {
|
||||||
|
|
||||||
if (!(handle = init_processing_handle(cmd))) {
|
|
||||||
log_error("Failed to initialize processing handle.");
|
log_error("Failed to initialize processing handle.");
|
||||||
ret = ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->custom_handle = &lp;
|
handle->custom_handle = &lp;
|
||||||
@ -3537,10 +3535,10 @@ int lvconvert(struct cmd_context * cmd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!dm_list_empty(&lp.idls))
|
|
||||||
dm_pool_free(cmd->mem, dm_list_item(dm_list_first(&lp.idls), struct convert_poll_id_list));
|
|
||||||
if (lp.policy_settings)
|
if (lp.policy_settings)
|
||||||
dm_config_destroy(lp.policy_settings);
|
dm_config_destroy(lp.policy_settings);
|
||||||
|
|
||||||
destroy_processing_handle(cmd, handle);
|
destroy_processing_handle(cmd, handle);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user