mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-11 20:58:50 +03:00
writecache: activate to check block size
backport fixes from later commit
This commit is contained in:
parent
38eaa1035b
commit
ba27b9ee2a
@ -5499,14 +5499,17 @@ static int _set_writecache_block_size(struct cmd_context *cmd,
|
|||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dm_snprintf(pathname, sizeof(pathname), "%s%s/%s", cmd->dev_dir,
|
if (dm_snprintf(pathname, sizeof(pathname), "%s/%s/%s", cmd->dev_dir,
|
||||||
lv->vg->name, lv->name) < 0) {
|
lv->vg->name, lv->name) < 0) {
|
||||||
log_error("Path name too long to get LV block size %s", display_lvname(lv));
|
log_error("Path name too long to get LV block size %s", display_lvname(lv));
|
||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sync_local_dev_names(cmd))
|
||||||
|
stack;
|
||||||
|
|
||||||
if (!(fs_dev = dev_cache_get(cmd, pathname, NULL))) {
|
if (!(fs_dev = dev_cache_get(cmd, pathname, NULL))) {
|
||||||
log_error("Device for LV not found to check block size %s", display_lvname(lv));
|
log_error("Device for LV not found to check block size %s", pathname);
|
||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5608,6 +5611,7 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
|||||||
char *lockd_fast_name = NULL;
|
char *lockd_fast_name = NULL;
|
||||||
struct id lockd_fast_id;
|
struct id lockd_fast_id;
|
||||||
char cvol_name[NAME_LEN];
|
char cvol_name[NAME_LEN];
|
||||||
|
int is_active;
|
||||||
|
|
||||||
fast_name = arg_str_value(cmd, cachevol_ARG, "");
|
fast_name = arg_str_value(cmd, cachevol_ARG, "");
|
||||||
|
|
||||||
@ -5637,6 +5641,8 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_active = lv_is_active(lv);
|
||||||
|
|
||||||
memset(&settings, 0, sizeof(settings));
|
memset(&settings, 0, sizeof(settings));
|
||||||
|
|
||||||
if (!get_writecache_settings(cmd, &settings, &block_size_sectors)) {
|
if (!get_writecache_settings(cmd, &settings, &block_size_sectors)) {
|
||||||
@ -5644,8 +5650,26 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_set_writecache_block_size(cmd, lv, &block_size_sectors))
|
if (!is_active) {
|
||||||
|
/* checking block size of fs on the lv requires the lv to be active */
|
||||||
|
if (!activate_lv(cmd, lv)) {
|
||||||
|
log_error("Failed to activate LV to check block size %s", display_lvname(lv));
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_set_writecache_block_size(cmd, lv, &block_size_sectors)) {
|
||||||
|
if (!is_active && !deactivate_lv(cmd, lv))
|
||||||
|
stack;
|
||||||
goto_bad;
|
goto_bad;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_active) {
|
||||||
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
|
log_error("Failed to deactivate LV after checking block size %s", display_lvname(lv));
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!arg_is_set(cmd, yes_ARG) &&
|
if (!arg_is_set(cmd, yes_ARG) &&
|
||||||
yes_no_prompt("Erase all existing data on %s? [y/n]: ", display_lvname(lv_fast)) == 'n') {
|
yes_no_prompt("Erase all existing data on %s? [y/n]: ", display_lvname(lv_fast)) == 'n') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user