diff options
Diffstat (limited to 'lib/metadata/lv_manip.c')
-rw-r--r-- | lib/metadata/lv_manip.c | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 91bc6bd0d..aa4f31c14 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -6346,7 +6346,6 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv, struct fs_info fsinfo2; uint64_t newsize_bytes_lv; uint64_t newsize_bytes_fs; - int mounted = 0, unmounted = 0; int ret = 0; memset(&fsinfo, 0, sizeof(fsinfo)); @@ -6391,7 +6390,7 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv, * the LV size, so that the FS does not see an incorrect device size. */ if (!fsinfo.needs_reduce && fsinfo.needs_crypt && !test_mode()) { - ret = crypt_resize_command(cmd, fsinfo.crypt_devt, newsize_bytes_fs); + ret = crypt_resize_script(cmd, lv, &fsinfo, newsize_bytes_fs); goto out; } @@ -6425,31 +6424,9 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv, */ unlock_vg(cmd, lv->vg, lv->vg->name); - if (fsinfo.needs_unmount) { - if (!fs_unmount_command(cmd, lv, &fsinfo)) - goto_out; - unmounted = 1; - } - - if (fsinfo.needs_fsck) { - if (!fs_fsck_command(cmd, lv, &fsinfo)) - goto_out; - } - - if (fsinfo.needs_mount) { - if (!fs_mount_command(cmd, lv, &fsinfo, 0)) - goto_out; - mounted = 1; - } - - if (!fs_reduce_command(cmd, lv, &fsinfo, newsize_bytes_fs)) + if (!fs_reduce_script(cmd, lv, &fsinfo, newsize_bytes_fs, lp->fsopt)) goto_out; - if (fsinfo.needs_crypt) { - if (!crypt_resize_command(cmd, fsinfo.crypt_devt, newsize_bytes_fs)) - goto_out; - } - if (!lock_vol(cmd, lv->vg->name, LCK_VG_WRITE, NULL)) { log_error("Failed to lock VG, cannot reduce LV."); ret = 0; @@ -6482,16 +6459,6 @@ static int _fs_reduce(struct cmd_context *cmd, struct logical_volume *lv, } ret = 1; - - /* - * put the fs back into the original mounted|unmounted state. - */ - if (!strcmp(lp->fsopt, "resize_remount") || !strcmp(lp->fsopt, "resize")) { - if (mounted && !fs_unmount_command(cmd, lv, &fsinfo)) - ret = 0; - if (unmounted && !fs_mount_command(cmd, lv, &fsinfo, 1)) - ret = 0; - } out: return ret; } @@ -6500,7 +6467,6 @@ static int _fs_extend(struct cmd_context *cmd, struct logical_volume *lv, struct lvresize_params *lp) { struct fs_info fsinfo; - int mounted = 0, unmounted = 0; int ret = 0; memset(&fsinfo, 0, sizeof(fsinfo)); @@ -6550,42 +6516,10 @@ static int _fs_extend(struct cmd_context *cmd, struct logical_volume *lv, */ unlock_vg(cmd, lv->vg, lv->vg->name); - if (fsinfo.needs_unmount) { - if (!fs_unmount_command(cmd, lv, &fsinfo)) - goto_out; - unmounted = 1; - } - - if (fsinfo.needs_fsck) { - if (!fs_fsck_command(cmd, lv, &fsinfo)) - goto_out; - } - - if (fsinfo.needs_crypt) { - if (!crypt_resize_command(cmd, fsinfo.crypt_devt, 0)) - goto_out; - } - - if (fsinfo.needs_mount) { - if (!fs_mount_command(cmd, lv, &fsinfo, 0)) - goto_out; - mounted = 1; - } - - if (!fs_extend_command(cmd, lv, &fsinfo)) + if (!fs_extend_script(cmd, lv, &fsinfo, lp->fsopt)) goto_out; ret = 1; - - /* - * put the fs back into the original mounted|unmounted state. - */ - if (!strcmp(lp->fsopt, "resize_remount") || !strcmp(lp->fsopt, "resize")) { - if (mounted && !fs_unmount_command(cmd, lv, &fsinfo)) - ret = 0; - if (unmounted && !fs_mount_command(cmd, lv, &fsinfo, 1)) - ret = 0; - } out: return ret; } |