mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmlockd: disable lvb for sanlock
The lvb is used to hold lock versions, but lock verions are no longer used (since the removal of lvmetad), so the lvb is not actually useful. Disable their use for sanlock to avoid the extra i/o required to maintain the lvb.
This commit is contained in:
parent
58e75f6178
commit
55687b6656
@ -16,6 +16,8 @@
|
||||
#define LVMLOCKD_SOCKET DEFAULT_RUN_DIR "/lvmlockd.socket"
|
||||
#define LVMLOCKD_ADOPT_FILE DEFAULT_RUN_DIR "/lvmlockd.adopt"
|
||||
|
||||
#define LVMLOCKD_USE_SANLOCK_LVB 0
|
||||
|
||||
/* Wrappers to open/close connection */
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
|
@ -1320,7 +1320,9 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act
|
||||
* once someone uses the lock and writes a new lvb value.
|
||||
* Do nothing.
|
||||
*/
|
||||
/*
|
||||
log_debug("S %s R %s res_lock version_zero_valid still zero", ls->name, r->name);
|
||||
*/
|
||||
|
||||
} else if (r->version_zero_valid && vb.r_version) {
|
||||
/*
|
||||
|
@ -1610,12 +1610,17 @@ static int lm_add_resource_sanlock(struct lockspace *ls, struct resource *r)
|
||||
|
||||
/* LD_RT_LV offset is set in each lm_lock call from lv_args. */
|
||||
|
||||
/*
|
||||
* Disable sanlock lvb since lock versions are not currently used for
|
||||
* anything, and it's nice to avoid the extra i/o used for lvb's.
|
||||
*/
|
||||
#if LVMLOCKD_USE_SANLOCK_LVB
|
||||
if (r->type == LD_RT_GL || r->type == LD_RT_VG) {
|
||||
rds->vb = zalloc(sizeof(struct val_blk));
|
||||
if (!rds->vb)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1624,9 +1629,9 @@ int lm_rem_resource_sanlock(struct lockspace *ls, struct resource *r)
|
||||
struct rd_sanlock *rds = (struct rd_sanlock *)r->lm_data;
|
||||
|
||||
/* FIXME: assert r->mode == UN or unlock if it's not? */
|
||||
|
||||
#ifdef LVMLOCKD_USE_SANLOCK_LVB
|
||||
free(rds->vb);
|
||||
|
||||
#endif
|
||||
memset(rds, 0, sizeof(struct rd_sanlock));
|
||||
r->lm_init = 0;
|
||||
return 0;
|
||||
|
@ -2301,12 +2301,22 @@ int lockd_vg_update(struct volume_group *vg)
|
||||
int result;
|
||||
int ret;
|
||||
|
||||
if (!vg_is_shared(vg))
|
||||
return 1;
|
||||
if (!_use_lvmlockd)
|
||||
return 0;
|
||||
if (!_lvmlockd_connected)
|
||||
return 0;
|
||||
if (!vg_is_shared(vg))
|
||||
return 1;
|
||||
|
||||
#if !LVMLOCKD_USE_SANLOCK_LVB
|
||||
/*
|
||||
* lvb (for lock version) is disabled for sanlock since
|
||||
* lock versions are not used any more, and it's more
|
||||
* costly for sanlock to implement (extra i/o.)
|
||||
*/
|
||||
if (!strcmp(vg->lock_type, "sanlock"))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
reply = _lockd_send("vg_update",
|
||||
"pid = " FMTd64, (int64_t) getpid(),
|
||||
|
Loading…
Reference in New Issue
Block a user