mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
fsadm: rename local variables to avoid confusion
This commit is contained in:
parent
213cea3aaa
commit
9916d8fa9a
@ -526,8 +526,8 @@ resize_xfs() {
|
|||||||
# 1) look for LUKS device with well-known UUID format (CRYPT-LUKS[12]-<uuid>-<dmname>)
|
# 1) look for LUKS device with well-known UUID format (CRYPT-LUKS[12]-<uuid>-<dmname>)
|
||||||
# 2) the dm-crypt device has to be on top of original device (dont't support detached LUKS headers)
|
# 2) the dm-crypt device has to be on top of original device (dont't support detached LUKS headers)
|
||||||
detect_luks_device() {
|
detect_luks_device() {
|
||||||
local _LUKS_VERSION=
|
local _LUKS_VERSION
|
||||||
local _LUKS_UUID=
|
local _LUKS_UUID
|
||||||
|
|
||||||
CRYPT_NAME=""
|
CRYPT_NAME=""
|
||||||
CRYPT_DATA_OFFSET=""
|
CRYPT_DATA_OFFSET=""
|
||||||
@ -564,9 +564,9 @@ detect_luks_device() {
|
|||||||
# - LUKS must be active for fs resize
|
# - LUKS must be active for fs resize
|
||||||
######################################
|
######################################
|
||||||
resize_luks() {
|
resize_luks() {
|
||||||
local NEWFSIZE=
|
local L_NEWSIZE
|
||||||
local NEWCBLOCKCOUNT=
|
local L_NEWBLOCKCOUNT
|
||||||
local NAME=""
|
local NAME
|
||||||
local SHRINK=0
|
local SHRINK=0
|
||||||
|
|
||||||
detect_luks_device
|
detect_luks_device
|
||||||
@ -585,25 +585,25 @@ resize_luks() {
|
|||||||
error "New size is smaller than minimum ($(((CRYPT_DATA_OFFSET + 1) * 512)) bytes) for LUKS device $VOLUME"
|
error "New size is smaller than minimum ($(((CRYPT_DATA_OFFSET + 1) * 512)) bytes) for LUKS device $VOLUME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NEWCBLOCKCOUNT=$((NEWBLOCKCOUNT - CRYPT_DATA_OFFSET))
|
L_NEWBLOCKCOUNT=$((NEWBLOCKCOUNT - CRYPT_DATA_OFFSET))
|
||||||
NEWFSIZE=$(( NEWCBLOCKCOUNT * 512))
|
L_NEWSIZE=$(( L_NEWBLOCKCOUNT * 512))
|
||||||
|
|
||||||
VOLUME="$DM_DEV_DIR/mapper/$NAME"
|
VOLUME="$DM_DEV_DIR/mapper/$NAME"
|
||||||
detect_device_size
|
detect_device_size
|
||||||
|
|
||||||
test "$DEVSIZE" -le "$NEWFSIZE" || SHRINK=1
|
test "$DEVSIZE" -le "$L_NEWSIZE" || SHRINK=1
|
||||||
|
|
||||||
if [ $SHRINK -eq 1 ]; then
|
if [ $SHRINK -eq 1 ]; then
|
||||||
# shrink fs on LUKS device first
|
# shrink fs on LUKS device first
|
||||||
resize "$DM_DEV_DIR/mapper/$NAME" "$NEWFSIZE"b
|
resize "$DM_DEV_DIR/mapper/$NAME" "$L_NEWSIZE"b
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# resize LUKS device
|
# resize LUKS device
|
||||||
dry $CRYPTSETUP resize $NAME --size $NEWCBLOCKCOUNT || error "Failed to resize active LUKS device"
|
dry $CRYPTSETUP resize $NAME --size $L_NEWBLOCKCOUNT || error "Failed to resize active LUKS device"
|
||||||
|
|
||||||
if [ $SHRINK -eq 0 ]; then
|
if [ $SHRINK -eq 0 ]; then
|
||||||
# grow fs on top of LUKS device
|
# grow fs on top of LUKS device
|
||||||
resize "$DM_DEV_DIR/mapper/$NAME" "$NEWFSIZE"b
|
resize "$DM_DEV_DIR/mapper/$NAME" "$L_NEWSIZE"b
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user