master - lvresize: do not pass struct cmd
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d44e653fe184a6c179a13998b41e13f737d4926c Commit: d44e653fe184a6c179a13998b41e13f737d4926c Parent: 5013999c8bd3f2b455ab6fe436df4884da6ebaf5 Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Jun 14 15:32:21 2016 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu Jun 23 14:57:09 2016 +0200
lvresize: do not pass struct cmd
Use common API design and pass just LV pointer to lv_manip.c functions.
Read cmd struct via lv->vg->cmd when needed.
Also do not try to return EINVALID_CMD_LINE error when we have already openned VG - this error code can only be returned before locking VG.
--- lib/locking/lvmlockd.c | 3 +- lib/metadata/lv_manip.c | 42 ++++++++++++++++++++++--------------- lib/metadata/metadata-exported.h | 7 ++--- liblvm/lvm_lv.c | 3 +- tools/lvresize.c | 7 +----- 5 files changed, 31 insertions(+), 31 deletions(-)
lib/locking/lvmlockd.c +1 -2
@@ -376,8 +376,7 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg, .sizeargs = 1, }; -if (!lv_resize_prepare (cmd, lv, &lp, &vg->pvs) || - !lv_resize (cmd, lv, &lp, &vg->pvs)) { +if (!lv_resize (lv, &lp, &vg->pvs)) {log_error ("Extend LV %s to size %s failed." ,display_lvname (lv),display_size (cmd, lp.size));return 0 ;
lib/metadata/lv_manip.c +25 -17
117 lines not on this page · raw message
lib/metadata/metadata-exported.h +3 -4
@@ -693,10 +693,9 @@ int vgs_are_compatible(struct cmd_context *cmd, struct volume_group *vg_to);uint32_t vg_lock_newname (struct cmd_context *cmd,const char *vgname); -int lv_resize_prepare (struct cmd_context *cmd,struct logical_volume *lv, -struct lvresize_params *lp,struct dm_list *pvh); -int lv_resize (struct cmd_context *cmd,struct logical_volume *lv, -struct lvresize_params *lp,struct dm_list *pvh); +int lv_resize (struct logical_volume *lv, +struct lvresize_params *lp, +struct dm_list *pvh);/* * Return a handle to VG metadata.
liblvm/lvm_lv.c +1 -2
@@ -467,8 +467,7 @@ int lvm_lv_resize(const lv_t lv, uint64_t new_size) };struct saved_env e =store_user_env (lv->vg->cmd); -if (!lv_resize_prepare (lv->vg->cmd, lv, &lp, &lv->vg->pvs) || - !lv_resize (lv->vg->cmd, lv, &lp, &lv->vg->pvs)) { +if (!lv_resize (lv, &lp, &lv->vg->pvs)) {/* FIXME Improve msg */ log_error ("LV resize failed." );/* FIXME Define consistent symbolic return codes */
tools/lvresize.c +1 -6
@@ -175,12 +175,7 @@ static int _lvresize_single(struct cmd_context *cmd, const char *vg_name,if (!(pvh = lp->argc ?create_pv_list (cmd->mem, vg, lp->argc, lp->argv,1 ) : &vg->pvs)) goto_out; -if (!lv_resize_prepare (cmd, lv, lp, pvh)) { - ret =EINVALID_CMD_LINE ; - goto_out; - } - -if (!lv_resize (cmd, lv, lp, pvh)) +if (!lv_resize (lv, lp, pvh)) goto_out; ret =ECMD_PROCESSED ;