Pass pointer to logical volume instead of path to lvconvert_poll function. This will make polling for merge easier. Signed-off-by: Mikulas Patocka --- tools/lvchange.c | 10 +--------- tools/lvconvert.c | 20 +++++++++++++++----- tools/tools.h | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) Index: LVM2.2.02.43/tools/lvchange.c =================================================================== --- LVM2.2.02.43.orig/tools/lvchange.c 2008-07-31 15:03:01.000000000 +0200 +++ LVM2.2.02.43/tools/lvchange.c 2008-11-25 19:14:34.000000000 +0100 @@ -104,8 +104,6 @@ static int lvchange_availability(struct { int activate; const char *pvname; - char *lv_full_name; - uint32_t len; activate = arg_uint_value(cmd, available_ARG, 0); @@ -150,15 +148,9 @@ static int lvchange_availability(struct } if (lv->status & CONVERTING) { - len = strlen(lv->vg->name) + strlen(lv->name) + 2; - if (!(lv_full_name = alloca(len))) - return_0; - if (!dm_snprintf(lv_full_name, len, "%s/%s", - lv->vg->name, lv->name)) - return_0; log_verbose("Spawning background lvconvert process for %s", lv->name); - lvconvert_poll(cmd, lv_full_name, 1); + lvconvert_poll(cmd, lv, 1); } } Index: LVM2.2.02.43/tools/lvconvert.c =================================================================== --- LVM2.2.02.43.orig/tools/lvconvert.c 2008-11-25 19:10:17.000000000 +0100 +++ LVM2.2.02.43/tools/lvconvert.c 2008-11-25 19:14:34.000000000 +0100 @@ -41,6 +41,8 @@ struct lvconvert_params { int pv_count; char **pvs; struct dm_list *pvh; + + struct logical_volume *lv_to_poll; }; static int _lvconvert_name_params(struct lvconvert_params *lp, @@ -331,11 +333,18 @@ static struct poll_functions _lvconvert_ .finish_copy = _finish_lvconvert_mirror, }; -int lvconvert_poll(struct cmd_context *cmd, const char *lv_name, +int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv, unsigned background) { - return poll_daemon(cmd, lv_name, background, 0, &_lvconvert_mirror_fns, - "Converted"); + char *lv_full_name; + size_t len = strlen(lv->vg->name) + strlen(lv->name) + 2; + if (!(lv_full_name = alloca(len))) + return_0; + if (!dm_snprintf(lv_full_name, len, "%s/%s", + lv->vg->name, lv->name)) + return_0; + return poll_daemon(cmd, lv_full_name, background, 0, + &_lvconvert_mirror_fns, "Converted"); } static int _insert_lvconvert_layer(struct cmd_context *cmd, @@ -842,17 +851,18 @@ int lvconvert(struct cmd_context * cmd, } else lp.pvh = &vg->pvs; + lp.lv_to_poll = lvl->lv; ret = lvconvert_single(cmd, lvl->lv, &lp); bad: unlock_vg(cmd, lp.vg_name); if (ret == ECMD_PROCESSED && lp.need_polling) { - if (!lv_info(cmd, lvl->lv, &info, 1, 0) || !info.exists) { + if (!lv_info(cmd, lp.lv_to_poll, &info, 1, 0) || !info.exists) { log_print("Conversion starts after activation"); return ret; } - ret = lvconvert_poll(cmd, lp.lv_name_full, + ret = lvconvert_poll(cmd, lp.lv_to_poll, lp.wait_completion ? 0 : 1U); } Index: LVM2.2.02.43/tools/tools.h =================================================================== --- LVM2.2.02.43.orig/tools/tools.h 2008-11-04 15:57:06.000000000 +0100 +++ LVM2.2.02.43/tools/tools.h 2008-11-25 19:14:34.000000000 +0100 @@ -168,6 +168,6 @@ int arg_count_increment(struct cmd_conte const char *command_name(struct cmd_context *cmd); int pvmove_poll(struct cmd_context *cmd, const char *pv, unsigned background); -int lvconvert_poll(struct cmd_context *cmd, const char *lv_name, unsigned background); +int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv, unsigned background); #endif