master - Remove unused clvm variations for active LVs
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c157c43f7cca085651fab13937ee11e526fe88cf Commit: c157c43f7cca085651fab13937ee11e526fe88cf Parent: eb600292455b1b2b2e88db74e13b7db848701b92 Author: David Teigland <[email protected]> AuthorDate: Tue Jun 5 13:21:28 2018 -0500 Committer: David Teigland <[email protected]> CommitterDate: Wed Jun 6 13:58:34 2018 -0500
Remove unused clvm variations for active LVs
Different flavors of activate_lv() and lv_is_active() which are meaningful in a clustered VG can be eliminated and replaced with whatever that flavor already falls back to in a local VG.
e.g. lv_is_active_exclusive_locally() is distinct from lv_is_active() in a clustered VG, but in a local VG they are equivalent. So, all instances of the variant are replaced with the basic local equivalent.
For local VGs, the same behavior remains as before. For shared VGs, lvmlockd was written with the explicit requirement of local behavior from these functions (lvmlockd requires locking_type 1), so the behavior in shared VGs also remains the same.
--- lib/activate/activate.c | 131 ++-------------------------------------- lib/activate/activate.h | 6 -- lib/locking/locking.c | 18 +----- lib/locking/locking.h | 10 +--- lib/metadata/cache_manip.c | 6 +- lib/metadata/lv.c | 64 ++------------------ lib/metadata/lv.h | 2 +- lib/metadata/lv_manip.c | 36 +++++------- lib/metadata/mirror.c | 65 ++------------------ lib/metadata/pool_manip.c | 2 +- lib/metadata/raid_manip.c | 46 ++++---------- lib/metadata/snapshot_manip.c | 6 -- lib/metadata/thin_manip.c | 4 +- lib/report/report.c | 40 +------------ tools/lvchange.c | 11 +-- tools/lvconvert.c | 27 ++++----- tools/lvcreate.c | 4 +- tools/polldaemon.c | 4 +- tools/pvmove.c | 8 +-- tools/toollib.c | 4 +- tools/vgchange.c | 16 +----- 21 files changed, 88 insertions(+), 422 deletions(-)
lib/activate/activate.c +7 -124
@@ -374,31 +374,6 @@ int lv_is_active(const struct logical_volume *lv) {return 0 ; } -int lv_is_active_locally (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_is_active_remotely (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_is_active_but_not_locally (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_is_active_exclusive (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_is_active_exclusive_locally (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_is_active_exclusive_remotely (const struct logical_volume *lv) -{ -return 0 ; -} -int lv_check_transient (struct logical_volume *lv) {return 1 ;
@@ -1471,61 +1446,6 @@ int lvs_in_vg_opened(const struct volume_group *vg) }/* -* _lv_is_active -* @lv: logical volume being queried -* @locally: set if active locally (when provided) -* @remotely: set if active remotely (when provided) -* @exclusive: set if active exclusively (when provided) -* -* Determine whether an LV is active locally or in a cluster. -* In addition to the return code which indicates whether or -* not the LV is active somewhere, two other values are set -* to yield more information about the status of the activation: -* -* return locally exclusively status -* ====== ======= =========== ====== -* 0 0 0 not active -* 1 0 0 active remotely -* 1 0 1 exclusive remotely -* 1 1 0 active locally and possibly remotely -* 1 1 1 exclusive locally (or local && !cluster) -* The VG lock must be held to call this function. -* -* Returns: 0 or 1 -*/ -static int _lv_is_active (const struct logical_volume *lv, -int *locally,int *remotely,int *exclusive) -{ -int r, l, e;/* remote, local, and exclusive */ -int skip_cluster_query =0 ; - - r = l = e =0 ; - -if (_lv_active (lv->vg->cmd, lv)) - l =1 ; - -if (l) - e =1 ;/* exclusive by definition */ - -if (locally) - *locally = l; -if (exclusive) - *exclusive = e; -if (remotely) - *remotely = r; - -log_very_verbose ("%s is %sactive%s%s%s%s" , -display_lvname (lv), - (r || l) ?"" :"not " , - (exclusive && e) ?" exclusive" :"" , - l ?" locally" :"" , - (!skip_cluster_query && l && r) ?" and" :"" , - (!skip_cluster_query && r) ?" remotely" :"" ); - -return r || l; -} - -/* * Check if "raid4" @segtype is supported by kernel. * * if segment type is not raid4, return 1.
@@ -1545,51 +1465,14 @@ int raid4_is_supported(struct cmd_context *cmd, const struct segment_type *segtyreturn 1 ; } +/* +* The VG lock must be held to call this function. +* +* Returns: 0 or 1 +*/ int lv_is_active (const struct logical_volume *lv) { -return _lv_is_active (lv,NULL ,NULL ,NULL ); -} - -int lv_is_active_locally (const struct logical_volume *lv) -{ -int l; - -return _lv_is_active (lv, &l,NULL ,NULL ) && l; -} - -int lv_is_active_remotely (const struct logical_volume *lv) -{ -int r; - -return _lv_is_active (lv,NULL , &r,NULL ) && r; -} - -int lv_is_active_but_not_locally (const struct logical_volume *lv) -{ -int l; - -return _lv_is_active (lv, &l,NULL ,NULL ) && !l; -} - -int lv_is_active_exclusive (const struct logical_volume *lv) -{ -int e; - -return _lv_is_active (lv,NULL ,NULL , &e) && e; -} - -int lv_is_active_exclusive_locally (const struct logical_volume *lv) -{ -int l, e; - -return _lv_is_active (lv, &l,NULL , &e) && l && e; -} - -int lv_is_active_exclusive_remotely (const struct logical_volume *lv) -{ -int l, e; - -return _lv_is_active (lv, &l,NULL , &e) && !l && e; +return _lv_active (lv->vg->cmd, lv); }#ifdef DMEVENTD
@@ -1991,7 +1874,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volumecontinue ;if (!vg_write_lock_held () &&lv_is_mirror (lv)) { - mirr_laopts.exclusive =lv_is_active_exclusive_locally (lv) ?1 :0 ; + mirr_laopts.exclusive =lv_is_active (lv) ?1 :0 ;/* * Commands vgchange and lvchange do use read-only lock when changing * monitoring (--monitor y|n). All other use cases hold 'write-lock'
lib/activate/activate.h +0 -6
@@ -191,12 +191,6 @@ int lvs_in_vg_activated(const struct volume_group *vg);int lvs_in_vg_opened (const struct volume_group *vg);int lv_is_active (const struct logical_volume *lv); -int lv_is_active_locally (const struct logical_volume *lv); -int lv_is_active_remotely (const struct logical_volume *lv); -int lv_is_active_but_not_locally (const struct logical_volume *lv); -int lv_is_active_exclusive (const struct logical_volume *lv); -int lv_is_active_exclusive_locally (const struct logical_volume *lv); -int lv_is_active_exclusive_remotely (const struct logical_volume *lv);/* Check is any component LV is active */ const struct logical_volume *lv_component_is_active (const struct logical_volume *lv);
lib/locking/locking.c +2 -16
@@ -273,16 +273,6 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, const strreturn 1 ; } -/* -* First try to activate exclusively locally. -* Then if the VG is clustered and the LV is not yet active (e.g. due to -* an activation filter) try activating on remote nodes. -*/ -int activate_lv_excl (struct cmd_context *cmd,const struct logical_volume *lv) -{ -return activate_lv_excl_local (cmd, lv); -} -/* Lock a list of LVs */ int activate_lvs (struct cmd_context *cmd,struct dm_list *lvs,unsigned exclusive) {
@@ -290,13 +280,9 @@ int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusivstruct lv_list *lvl; dm_list_iterate_items(lvl, lvs) { -if (!exclusive && !lv_is_active_exclusive (lvl->lv)) { -if (!activate_lv (cmd, lvl->lv)) { -log_error ("Failed to activate %s" ,display_lvname (lvl->lv)); -return 0 ; - } - }else if (!activate_lv_excl (cmd, lvl->lv)) { +if (!activate_lv (cmd, lvl->lv)) {log_error ("Failed to activate %s" ,display_lvname (lvl->lv)); + dm_list_uniterate(lvh, lvs, &lvl->list) { lvl = dm_list_item(lvh, struct lv_list);if (!deactivate_lv (cmd, lvl->lv))
lib/locking/locking.h +2 -8
@@ -231,20 +231,14 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname); })#define suspend_lv (cmd, lv) \ (lock_activation((cmd), (lv)) ? lock_lv_vol((cmd), (lv), LCK_LV_SUSPEND | LCK_HOLD) : 0) +#define suspend_lv_origin (cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD | LCK_ORIGIN_ONLY) +#define deactivate_lv (cmd, lv) lock_lv_vol_serially(cmd, lv, LCK_LV_DEACTIVATE)#define activate_lv (cmd, lv) lock_lv_vol_serially(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD) -#define activate_lv_excl_local (cmd, lv) \ - lock_lv_vol_serially(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_LOCAL) -#define activate_lv_excl_remote (cmd, lv) \ - lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_REMOTE)struct logical_volume ; -int activate_lv_excl (struct cmd_context *cmd,const struct logical_volume *lv); - -#define activate_lv_local (cmd, lv) \ - lock_lv_vol_serially(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)#define deactivate_lv_local (cmd, lv) \ lock_lv_vol_serially(cmd, lv, LCK_LV_DEACTIVATE | LCK_LOCAL)
lib/metadata/cache_manip.c +3 -3
@@ -566,8 +566,8 @@ int lv_cache_remove(struct logical_volume *cache_lv)default :/* Otherwise localy activate volume to sync dirty blocks */ cache_lv->status |=LV_TEMPORARY ; -if (!activate_lv_excl_local (cache_lv->vg->cmd, cache_lv) || - !lv_is_active_locally (cache_lv)) { +if (!activate_lv (cache_lv->vg->cmd, cache_lv) || + !lv_is_active (cache_lv)) {log_error ("Failed to active cache locally %s." ,display_lvname (cache_lv));return 0 ;
@@ -969,7 +969,7 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv) } cache_pool_lv->status |=LV_TEMPORARY ; -if (!activate_lv_excl_local (cache_pool_lv->vg->cmd, cache_pool_lv)) { +if (!activate_lv (cache_pool_lv->vg->cmd, cache_pool_lv)) {log_error ("Aborting. Failed to activate cache pool %s." ,display_lvname (cache_pool_lv));return 0 ;
lib/metadata/lv.c +7 -57
111 lines not on this page · raw message
lib/metadata/lv.h +1 -1
@@ -153,7 +153,7 @@ char *lvseg_kernel_discards_dup(struct dm_pool *mem, const struct lv_segment *seint lv_set_creation (struct logical_volume *lv,const char *hostname,uint64_t timestamp);int lv_active_change (struct cmd_context *cmd,struct logical_volume *lv, -enum activation_change activate,int needs_exclusive); +enum activation_change activate);/* LV dup functions */ char *lv_attr_dup_with_info_and_seg_status (struct dm_pool *mem,const struct lv_with_info_and_seg_status *lvdm);
lib/metadata/lv_manip.c +15 -21
@@ -4058,7 +4058,7 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,for (s =0 ; !fail && s < seg->area_count; s++) { meta_lv =seg_metalv (seg, s); -if (!activate_lv_local (meta_lv->vg->cmd, meta_lv)) { +if (!activate_lv (meta_lv->vg->cmd, meta_lv)) {log_error ("Failed to activate %s for clearing." ,display_lvname (meta_lv)); fail =1 ;
@@ -4228,7 +4228,7 @@ int lv_extend(struct logical_volume *lv, (lv_is_not_synced(lv))) {dm_percent_t sync_percent =DM_PERCENT_INVALID ; -if (!lv_is_active_locally (lv)) { +if (!lv_is_active (lv)) {log_error ("Unable to read sync percent while LV %s " "is not locally active." ,display_lvname (lv));/* FIXME Support --force */
@@ -4711,7 +4711,7 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,return 0 ; } -if (!lv_is_active_locally (lv)) { +if (!lv_is_active (lv)) {log_error ("Can't read state of locally inactive LV %s." ,display_lvname (lv));return 0 ;
@@ -5571,7 +5571,7 @@ int lv_resize(struct logical_volume *lv,* then use suspend and resume and deactivate pool LV, * instead of searching for an active thin volume. */ -if (!activate_lv_excl (cmd, lock_lv)) { +if (!activate_lv (cmd, lock_lv)) {log_error ("Failed to activate %s." ,display_lvname (lock_lv));return 0 ; }
@@ -6788,7 +6788,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,struct segment_type *segtype;struct lv_segment *mapseg;struct lv_names lv_names; -unsigned exclusive =0 , i; +unsigned i;/* create an empty layer LV */ if (dm_snprintf (name,sizeof (name),"%s%s" , lv_where->name, layer_suffix) <0 ) {
@@ -6804,9 +6804,6 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,return NULL ; } -if (lv_is_active_exclusive_locally (lv_where)) - exclusive =1 ; -if (lv_is_active (lv_where) &&strstr (name,MIRROR_SYNC_LAYER )) {log_very_verbose ("Creating transient LV %s for mirror conversion in VG %s." , name, lv_where->vg->name);
@@ -6835,10 +6832,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,return NULL ; } -if (exclusive) - r =activate_lv_excl (cmd, layer_lv); -else - r =activate_lv (cmd, layer_lv); + r =activate_lv (cmd, layer_lv);if (!r) { log_error("Failed to resume transient LV"
@@ -7125,7 +7119,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)/* nothing to do */ return 1 ; -if (!lv_is_active_locally (lv)) { +if (!lv_is_active (lv)) {log_error ("Volume \"%s/%s\" is not active locally (volume_list activation filter?)." , lv->vg->name, lv->name);return 0 ;
@@ -7491,7 +7485,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, return_NULL;/* New pool is now inactive */ }else { -if (!activate_lv_excl_local (cmd, pool_lv)) { +if (!activate_lv (cmd, pool_lv)) {log_error ("Aborting. Failed to locally activate thin pool %s." ,display_lvname (pool_lv));return NULL ;
@@ -7783,7 +7777,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,if (seg_is_cache (lp)) {if (vg_is_shared (vg)) {if (is_change_activating (lp->activate)) { -if (!lv_active_change (cmd, lv,CHANGE_AEY ,0 )) { +if (!lv_active_change (cmd, lv,CHANGE_AEY )) {log_error ("Aborting. Failed to activate LV %s." ,display_lvname (lv)); goto revert_new_lv;
@@ -7794,7 +7788,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,/* FIXME Support remote exclusive activation? */ /* Not yet 'cache' LV, it is stripe volume for wiping */ - else if (is_change_activating(lp->activate) && !activate_lv_excl_local(cmd, lv)) { + else if (is_change_activating(lp->activate) && !activate_lv(cmd, lv)) {log_error ("Aborting. Failed to activate LV %s locally exclusively." ,display_lvname (lv)); goto revert_new_lv;
@@ -7827,7 +7821,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,/* Avoid multiple thin-pool activations in this case */ if (thin_pool_was_active <0 ) thin_pool_was_active =0 ; -if (!activate_lv_excl (cmd, pool_lv)) { +if (!activate_lv (cmd, pool_lv)) {log_error ("Failed to activate thin pool %s." ,display_lvname (pool_lv)); goto revert_new_lv;
@@ -7846,7 +7840,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, }backup (vg); -if (!lv_active_change (cmd, lv, lp->activate,0 )) { +if (!lv_active_change (cmd, lv, lp->activate)) {log_error ("Failed to activate thin %s." , lv->name); goto deactivate_and_revert_new_lv; }
@@ -7860,13 +7854,13 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, } }else if (lp->snapshot) { lv->status |=LV_TEMPORARY ; -if (!activate_lv_local (cmd, lv)) { +if (!activate_lv (cmd, lv)) {log_error ("Aborting. Failed to activate snapshot " "exception store." ); goto revert_new_lv; } lv->status &= ~LV_TEMPORARY ; - }else if (!lv_active_change (cmd, lv, lp->activate,0 )) { + }else if (!lv_active_change (cmd, lv, lp->activate)) {log_error ("Failed to activate new LV." ); goto deactivate_and_revert_new_lv; }
@@ -7968,7 +7962,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,*/ /* Activate spare snapshot once it is a complete LV */ -if (!lv_active_change (cmd, origin_lv, lp->activate,1 )) { +if (!lv_active_change (cmd, origin_lv, lp->activate)) {log_error ("Failed to activate sparce volume %s." ,display_lvname (origin_lv));return NULL ;
lib/metadata/mirror.c +6 -59
118 lines not on this page · raw message
lib/metadata/pool_manip.c +1 -1
@@ -526,7 +526,7 @@ int create_pool(struct logical_volume *pool_lv,* or directly converted to invisible device via suspend/resume */ pool_lv->status |=LV_TEMPORARY ; -if (!activate_lv_excl_local (pool_lv->vg->cmd, pool_lv)) { +if (!activate_lv (pool_lv->vg->cmd, pool_lv)) {log_error ("Aborting. Failed to activate pool metadata %s." ,display_lvname (pool_lv)); goto bad;
lib/metadata/raid_manip.c +13 -33
117 lines not on this page · raw message
lib/metadata/snapshot_manip.c +0 -6
@@ -411,11 +411,5 @@ int validate_snapshot_origin(const struct logical_volume *origin_lv)return 0 ; } -if (vg_is_clustered (origin_lv->vg) &&lv_is_active (origin_lv) && - !lv_is_active_exclusive_locally (origin_lv)) { -log_error ("Snapshot origin must be active exclusively." ); -return 0 ; - } -return 1 ; }
lib/metadata/thin_manip.c +2 -2
@@ -504,7 +504,7 @@ int update_pool_lv(struct logical_volume *lv, int activate)* as this version has major problem when it does not know * which Node has pool active. */ -if (!activate_lv_excl (lv->vg->cmd, lv)) { +if (!activate_lv (lv->vg->cmd, lv)) {init_dmeventd_monitor (monitored); return_0; }
@@ -857,7 +857,7 @@ int check_new_thin_pool(const struct logical_volume *pool_lv)uint64_t transaction_id;/* For transaction_id check LOCAL activation is required */ -if (!activate_lv_excl_local (cmd, pool_lv)) { +if (!activate_lv (cmd, pool_lv)) {log_error ("Aborting. Failed to locally activate thin pool %s." ,display_lvname (pool_lv));return 0 ;
lib/report/report.c +3 -37
@@ -3559,11 +3559,7 @@ static int _lvactivelocally_disp(struct dm_report *rh, struct dm_pool *mem,if (!activation ())return _binary_undef_disp (rh, mem, field, private); -if (vg_is_clustered (lv->vg)) { - lv =lv_lock_holder (lv); - active_locally =lv_is_active_locally (lv); - }else - active_locally =lv_is_active (lv); + active_locally =lv_is_active (lv);return _binary_disp (rh, mem, field, active_locally,GET_FIRST_RESERVED_NAME (lv_active_locally_y), private); }
@@ -3572,38 +3568,12 @@ static int _lvactiveremotely_disp(struct dm_report *rh, struct dm_pool *mem,struct dm_report_field *field, const void *data, void *private) { - const struct logical_volume *lv = (const struct logical_volume *) data; int active_remotely;if (!activation ())return _binary_undef_disp (rh, mem, field, private); -if (vg_is_clustered (lv->vg)) { - lv =lv_lock_holder (lv); -/* FIXME: It seems we have no way to get this info correctly -* with current interface - we'd need to check number -* of responses from the cluster: -* - if number of nodes that responded == 1 -* - and LV is active on local node -* ..then we may say that LV is *not* active remotely. -* -* Otherwise ((responses > 1 && LV active locally) || -* (responses == 1 && LV not active locally)), it's -* active remotely. -* -* We have this info, but hidden underneath the -* locking interface (locking_type.query_resource fn). -* -* For now, let's use 'unknown' for remote status if -* the LV is found active locally until we find a way to -* smuggle the proper information out of the interface. -*/ -if (lv_is_active_locally (lv)) -return _binary_undef_disp (rh, mem, field, private); - - active_remotely =lv_is_active_but_not_locally (lv); - }else - active_remotely =0 ; + active_remotely =0 ;return _binary_disp (rh, mem, field, active_remotely,GET_FIRST_RESERVED_NAME (lv_active_remotely_y), private); }
@@ -3618,11 +3588,7 @@ static int _lvactiveexclusively_disp(struct dm_report *rh, struct dm_pool *mem,if (!activation ())return _binary_undef_disp (rh, mem, field, private); -if (vg_is_clustered (lv->vg)) { - lv =lv_lock_holder (lv); - active_exclusively =lv_is_active_exclusive (lv); - }else - active_exclusively =lv_is_active (lv); + active_exclusively =lv_is_active (lv);return _binary_disp (rh, mem, field, active_exclusively,GET_FIRST_RESERVED_NAME (lv_active_exclusively_y), private); }
tools/lvchange.c +4 -7
@@ -294,9 +294,6 @@ static int _reactivate_lv(struct logical_volume *lv,if (!active)return 1 ; -if (exclusive) -return activate_lv_excl_local (cmd, lv); -return activate_lv (cmd, lv); }
@@ -318,7 +315,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)dm_list_init (&device_list); -if (lv_is_active_locally (lv)) { +if (lv_is_active (lv)) {if (!lv_check_not_in_use (lv,1 )) {log_error ("Can't resync open logical volume %s." ,display_lvname (lv));
@@ -335,7 +332,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv) } active =1 ; -if (lv_is_active_exclusive_locally (lv)) +if (lv_is_active (lv)) exclusive =1 ; }
@@ -411,7 +408,7 @@ static int _lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)memlock_unlock (lv->vg->cmd); dm_list_iterate_items(lvl, &device_list) { -if (!activate_lv_excl_local (cmd, lvl->lv)) { +if (!activate_lv (cmd, lvl->lv)) {log_error ("Unable to activate %s for %s clearing." ,display_lvname (lvl->lv), (seg_is_raid (seg)) ?"metadata area" :"mirror log" );
@@ -621,7 +618,7 @@ static int _lvchange_persistent(struct cmd_context *cmd,if (activate !=CHANGE_AN ) {log_verbose ("Re-activating logical volume %s." ,display_lvname (lv)); -if (!lv_active_change (cmd, lv, activate,0 )) { +if (!lv_active_change (cmd, lv, activate)) {log_error ("%s: reactivation failed." ,display_lvname (lv));backup (lv->vg);return 0 ;
tools/lvconvert.c +12 -15
@@ -1767,7 +1767,7 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volureturn 0 ; } -if (lv_is_active_locally (cow)) { +if (lv_is_active (cow)) {if (!lv_check_not_in_use (cow,1 )) return_0;
@@ -1950,7 +1950,7 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,log_warn ("WARNING: %s not zeroed." , snap_name); else { lv->status |=LV_TEMPORARY ; -if (!activate_lv_excl_local (cmd, lv) || +if (!activate_lv (cmd, lv) || !wipe_lv (lv, (struct wipe_params ) { .do_zero =1 })) {log_error ("Aborting. Failed to wipe snapshot exception store." );return 0 ;
@@ -2037,7 +2037,7 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd,* constructor and DM should prevent appropriate devices from * being open. */ -if (lv_is_active_locally (origin)) { +if (lv_is_active (origin)) {if (!lv_check_not_in_use (origin,0 )) {log_print_unless_silent ("Delaying merge since origin is open." ); merge_on_activate =1 ;
@@ -2146,7 +2146,7 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,log_print_unless_silent ("Volume %s replaced origin %s." ,display_lvname (origin),display_lvname (lv)); -if (origin_is_active && !activate_lv_excl_local (cmd, lv)) { +if (origin_is_active && !activate_lv (cmd, lv)) {log_error ("Failed to reactivate origin %s." ,display_lvname (lv));return 0 ;
@@ -2254,13 +2254,13 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,return 0 ; } -if (!activate_lv_excl_local (cmd, pmslv)) { +if (!activate_lv (cmd, pmslv)) {log_error ("Cannot activate pool metadata spare volume %s." , pmslv->name);return 0 ; } -if (!activate_lv_excl_local (cmd, mlv)) { +if (!activate_lv (cmd, mlv)) {log_error ("Cannot activate thin pool metadata volume %s." , mlv->name); goto deactivate_pmslv;
@@ -2452,13 +2452,13 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,return 0 ; } -if (!activate_lv_excl_local (cmd, pmslv)) { +if (!activate_lv (cmd, pmslv)) {log_error ("Cannot activate pool metadata spare volume %s." , pmslv->name);return 0 ; } -if (!activate_lv_excl_local (cmd, mlv)) { +if (!activate_lv (cmd, mlv)) {log_error ("Cannot activate cache pool metadata volume %s." , mlv->name); goto deactivate_pmslv;
@@ -3106,7 +3106,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,if (zero_metadata) { metadata_lv->status |=LV_TEMPORARY ; -if (!activate_lv_excl_local (cmd, metadata_lv)) { +if (!activate_lv (cmd, metadata_lv)) {log_error ("Aborting. Failed to activate metadata lv." ); goto bad; }
@@ -3248,7 +3248,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, }if (activate_pool && - !activate_lv_excl (cmd, pool_lv)) { + !activate_lv (cmd, pool_lv)) {log_error ("Failed to activate pool logical volume %s." ,display_lvname (pool_lv));/* Deactivate subvolumes */
@@ -3461,11 +3461,8 @@ static int _lvconvert_repair_pvs_raid(struct cmd_context *cmd, struct logical_vostruct dm_list *failed_pvs;int do_it; -if (!lv_is_active_exclusive_locally (lv_lock_holder (lv))) { -log_error ("%s must be active %sto perform this operation." , -display_lvname (lv), -vg_is_clustered (lv->vg) ? -"exclusive locally " :"" ); +if (!lv_is_active (lv_lock_holder (lv))) { +log_error ("%s must be active to perform this operation." ,display_lvname (lv));return 0 ; }
tools/lvcreate.c +2 -2
@@ -1232,13 +1232,13 @@ static int _determine_cache_argument(struct volume_group *vg,return 1 ; }else if (vg_is_shared (vg)) { -if (!lv_active_change (cmd, lv,CHANGE_AEY ,0 )) { +if (!lv_active_change (cmd, lv,CHANGE_AEY )) {log_error ("Cannot activate cache origin %s." ,display_lvname (lv));return 0 ; } - }else if (!activate_lv_excl_local (cmd, lv)) { + }else if (!activate_lv (cmd, lv)) {log_error ("Cannot activate cache origin %s." ,display_lvname (lv));return 0 ;
tools/polldaemon.c +2 -2
@@ -200,7 +200,7 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,* If the LV is not active locally, the kernel cannot be * queried for its status. We must exit in this case. */ -if (!lv_is_active_locally (lv)) { +if (!lv_is_active (lv)) {log_print_unless_silent ("%s: Interrupted: No longer active." , id->display_name); ret =1 ; goto out;
@@ -440,7 +440,7 @@ static int _report_progress(struct cmd_context *cmd, struct poll_operation_id *i goto out; } -if (!lv_is_active_locally (lv)) { +if (!lv_is_active (lv)) {log_verbose ("%s: Interrupted: No longer active." , id->display_name); ret =1 ; goto out;
tools/pvmove.c +2 -6
@@ -466,8 +466,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,* in the case it's NOT active anywhere else, since LOCKED LVs cannot be * later activated by user. */ -if (lv_is_active_remotely (holder) || - (!lv_is_active_locally (holder) && !activate_lv_excl_local (cmd, holder))) { +if ((!lv_is_active (holder) && !activate_lv (cmd, holder))) { lv_skipped =1 ; log_print_unless_silent("Skipping LV %s which is not locally exclusive%s.", display_lvname(lv),
@@ -532,10 +531,7 @@ static int _activate_lv(struct cmd_context *cmd, struct logical_volume *lv_mirr, {int r =0 ; -if (exclusive ||lv_is_active_exclusive (lv_mirr)) - r =activate_lv_excl (cmd, lv_mirr); -else - r =activate_lv (cmd, lv_mirr); + r =activate_lv (cmd, lv_mirr);if (!r) stack;
tools/toollib.c +2 -2
@@ -1034,7 +1034,7 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,return 0 ; } -if (!lv_active_change (cmd, lv, activate,0 )) +if (!lv_active_change (cmd, lv, activate)) return_0;set_lv_notify (lv->vg->cmd);
@@ -1066,7 +1066,7 @@ int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)* - fortunately: polldaemon will immediately shutdown if the * origin doesn't have a status with a snapshot percentage */ -if (background_polling () &&lv_is_merging_origin (lv) &&lv_is_active_locally (lv)) +if (background_polling () &&lv_is_merging_origin (lv) &&lv_is_active (lv))lv_spawn_background_polling (cmd, lv);return 1 ;
tools/vgchange.c +2 -14
@@ -63,7 +63,7 @@ static int _poll_lvs_in_vg(struct cmd_context *cmd, dm_list_iterate_items(lvl, &vg->lvs) { lv = lvl->lv; -if (lv_is_active_locally (lv) && +if (lv_is_active (lv) && (lv_is_pvmove (lv) ||lv_is_converting (lv) ||lv_is_merging (lv))) {lv_spawn_background_polling (cmd, lv); count++;
@@ -116,20 +116,8 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg, expected_count++; -if (!lv_change_activate (cmd, lv, activate)) { -if (!lv_is_active_exclusive_remotely (lv)) - stack; -else { -/* -* If the LV is active exclusive remotely, -* then ignore it here -*/ -log_verbose ("%s is exclusively active on a remote node." , -display_lvname (lv)); - expected_count--;/* not accounted */ - } +if (!lv_change_activate (cmd, lv, activate))continue ; - } count++; }