mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
thin: detect supported features from thinp target
Add shell variable to override reported min version for testing: LVM_THIN_VERSION_MIN
This commit is contained in:
parent
c4db22bd4f
commit
260e8f2476
@ -1,5 +1,6 @@
|
||||
Version 2.02.97 -
|
||||
===============================
|
||||
Detect features for new 1.1 thin pool target.
|
||||
Count percentage of completeness upwards when merging a snapshot volume.
|
||||
Skip activation when using vg/lvchange --sysinit -a ay and lvmetad is active.
|
||||
Fix extending RAID 4/5/6 logical volumes
|
||||
|
@ -44,6 +44,15 @@ struct lv_activate_opts {
|
||||
/* target attribute flags */
|
||||
#define MIRROR_LOG_CLUSTERED 0x00000001U
|
||||
|
||||
/* thin target attribute flags */
|
||||
enum {
|
||||
/* bitfields - new features from 1.1 version */
|
||||
THIN_FEATURE_DISCARD = (1 << 0),
|
||||
THIN_FEATURE_EXTERNAL_ORIGIN = (1 << 1),
|
||||
THIN_FEATURE_HELD_ROOT = (1 << 2),
|
||||
THIN_FEATURE_BLOCK_SIZE = (1 << 3),
|
||||
};
|
||||
|
||||
void set_activation(int activation);
|
||||
int activation(void);
|
||||
|
||||
|
@ -487,16 +487,51 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
|
||||
|
||||
static int _thin_target_present(struct cmd_context *cmd,
|
||||
const struct lv_segment *seg,
|
||||
unsigned *attributes __attribute__((unused)))
|
||||
unsigned *attributes)
|
||||
{
|
||||
static int _checked = 0;
|
||||
static int _present = 0;
|
||||
static int _attrs = 0;
|
||||
uint32_t maj, min, patchlevel;
|
||||
|
||||
if (!_checked) {
|
||||
_present = target_present(cmd, THIN_MODULE, 1);
|
||||
|
||||
if (!target_version(THIN_MODULE, &maj, &min, &patchlevel)) {
|
||||
log_error("Cannot read " THIN_MODULE " target version.");
|
||||
return 0;
|
||||
}
|
||||
log_debug("Target " THIN_MODULE " has version %d:%d:%d.",
|
||||
maj, min, patchlevel);
|
||||
|
||||
/* For testing allow to override via shell variable */
|
||||
if (getenv("LVM_THIN_VERSION_MIN"))
|
||||
min = atoi(getenv("LVM_THIN_VERSION_MIN"));
|
||||
|
||||
if (maj >=1 && min >= 1)
|
||||
_attrs |= THIN_FEATURE_DISCARD;
|
||||
else
|
||||
log_verbose("Target " THIN_MODULE
|
||||
" without discard support.");
|
||||
|
||||
if (maj >=1 && min >= 1)
|
||||
_attrs |= THIN_FEATURE_EXTERNAL_ORIGIN;
|
||||
else
|
||||
log_verbose("Target " THIN_MODULE
|
||||
" without external origin support.");
|
||||
#if 0
|
||||
if (maj >=1 && min >= 1)
|
||||
_attrs |= THIN_FEATURE_BLOCK_SIZE;
|
||||
else
|
||||
log_verbose("Target " THIN_MODULE
|
||||
" without non power of 2 block size.");
|
||||
#endif
|
||||
_checked = 1;
|
||||
}
|
||||
|
||||
if (attributes)
|
||||
*attributes = _attrs;
|
||||
|
||||
return _present;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user