mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dev_manager: accept misalined vdo pools.
Since lvm2 may create VDO pool virtual size aligned only on extent size while VDO itself is just 4K aligned - we need to support such misalign.
This commit is contained in:
parent
829ab01708
commit
2e79b005c2
@ -277,7 +277,7 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
|
|||||||
int dmtask;
|
int dmtask;
|
||||||
int with_flush; /* TODO: arg for _info_run */
|
int with_flush; /* TODO: arg for _info_run */
|
||||||
void *target = NULL;
|
void *target = NULL;
|
||||||
uint64_t target_start, target_length, start, length, length_crop = 0;
|
uint64_t target_start, target_length, start, extent_size, length, length_crop = 0;
|
||||||
char *target_name, *target_params;
|
char *target_name, *target_params;
|
||||||
const char *devname;
|
const char *devname;
|
||||||
|
|
||||||
@ -306,8 +306,8 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
|
|||||||
|
|
||||||
/* Query status only for active device */
|
/* Query status only for active device */
|
||||||
if (seg_status && dminfo->exists) {
|
if (seg_status && dminfo->exists) {
|
||||||
start = length = seg_status->seg->lv->vg->extent_size;
|
extent_size = length = seg_status->seg->lv->vg->extent_size;
|
||||||
start *= seg_status->seg->le;
|
start = extent_size * seg_status->seg->le;
|
||||||
length *= _seg_len(seg_status->seg);
|
length *= _seg_len(seg_status->seg);
|
||||||
|
|
||||||
/* Uses max DM_THIN_MAX_METADATA_SIZE sectors for metadata device */
|
/* Uses max DM_THIN_MAX_METADATA_SIZE sectors for metadata device */
|
||||||
@ -328,6 +328,8 @@ static int _info_run(const char *dlid, struct dm_info *dminfo,
|
|||||||
|
|
||||||
if ((start == target_start) &&
|
if ((start == target_start) &&
|
||||||
((length == target_length) ||
|
((length == target_length) ||
|
||||||
|
((lv_is_vdo_pool(seg_status->seg->lv)) && /* should fit within extent size */
|
||||||
|
(length < target_length) && ((length + extent_size) > target_length)) ||
|
||||||
(length_crop && (length_crop == target_length))))
|
(length_crop && (length_crop == target_length))))
|
||||||
break; /* Keep target_params when matching segment is found */
|
break; /* Keep target_params when matching segment is found */
|
||||||
|
|
||||||
|
@ -263,7 +263,6 @@ static int _format_vdo_pool_data_lv(struct logical_volume *data_lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
reformat:
|
|
||||||
if (*logical_size) {
|
if (*logical_size) {
|
||||||
logical_size_aligned = 0;
|
logical_size_aligned = 0;
|
||||||
if (dm_snprintf(buf_args[args], sizeof(buf_args[0]), "--logical-size=" FMTu64 "K",
|
if (dm_snprintf(buf_args[args], sizeof(buf_args[0]), "--logical-size=" FMTu64 "K",
|
||||||
@ -374,13 +373,8 @@ reformat:
|
|||||||
// align obtained size to extent size
|
// align obtained size to extent size
|
||||||
logical_size_aligned = *logical_size / data_lv->vg->extent_size * data_lv->vg->extent_size;
|
logical_size_aligned = *logical_size / data_lv->vg->extent_size * data_lv->vg->extent_size;
|
||||||
if (*logical_size != logical_size_aligned) {
|
if (*logical_size != logical_size_aligned) {
|
||||||
*logical_size = logical_size_aligned;
|
log_debug("Using bigger VDO virtual size unaligned on extent size by %s.",
|
||||||
argv[1] = (char*) "--force";
|
display_size(data_lv->vg->cmd, *logical_size - logical_size_aligned));
|
||||||
args = 2;
|
|
||||||
reformating = 1;
|
|
||||||
log_verbose("Reformating VDO to align virtual size %s by extent size.",
|
|
||||||
display_size(data_lv->vg->cmd, *logical_size));
|
|
||||||
goto reformat;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user