mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
904e1e3d26
. When using default settings, this commit should change nothing. The first PE continues to be placed at 1 MiB resulting in a metadata area size of 1020 KiB (for 4K page sizes; slightly smaller for larger page sizes.) . When default_data_alignment is disabled in lvm.conf, align pe_start at 1 MiB, based on a default metadata area size that adapts to the page size. Previously, disabling this option would result in mda_size that was too small for common use, and produced a 64 KiB aligned pe_start. . Customized pe_start and mda_size values continue to be set as before in lvm.conf and command line. . Remove the configure option for setting default_data_alignment at build time. . Improve alignment related option descriptions. . Add section about alignment to pvcreate man page. Previously, DEFAULT_PVMETADATASIZE was 255 sectors. However, the fact that the config setting named "default_data_alignment" has a default value of 1 (MiB) meant that DEFAULT_PVMETADATASIZE was having no effect. The metadata area size is the space between the start of the metadata area (page size offset from the start of the device) and the first PE (1 MiB by default due to default_data_alignment 1.) The result is a 1020 KiB metadata area on machines with 4KiB page size (1024 KiB - 4 KiB), and smaller on machines with larger page size. If default_data_alignment was set to 0 (disabled), then DEFAULT_PVMETADATASIZE 255 would take effect, and produce a metadata area that was 188 KiB and pe_start of 192 KiB. This was too small for common use. This is fixed by making the default metadata area size a computed value that matches the value produced by default_data_alignment.
125 lines
3.8 KiB
Bash
125 lines
3.8 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# This copyrighted material is made available to anyone wishing to use,
|
|
# modify, copy, or redistribute it subject to the terms and conditions
|
|
# of the GNU General Public License v.2.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
SKIP_WITH_LVMPOLLD=1
|
|
|
|
. lib/inittest
|
|
|
|
which mkfs.ext3 || skip
|
|
|
|
lvdev_() {
|
|
echo "$DM_DEV_DIR/$1/$2"
|
|
}
|
|
|
|
test_snapshot_mount() {
|
|
lvcreate -aey -L4M -n $lv1 $vg "$dev1"
|
|
mkfs.ext3 -b4096 "$(lvdev_ $vg $lv1)"
|
|
mkdir test_mnt
|
|
mount "$(lvdev_ $vg $lv1)" test_mnt
|
|
lvcreate -L4M -n $lv2 -s $vg/$lv1
|
|
umount test_mnt
|
|
aux udev_wait
|
|
# mount the origin
|
|
mount "$(lvdev_ $vg $lv1)" test_mnt
|
|
umount test_mnt
|
|
aux udev_wait
|
|
# mount the snapshot
|
|
mount "$(lvdev_ $vg $lv2)" test_mnt
|
|
umount test_mnt
|
|
rm -r test_mnt
|
|
vgchange -an $vg
|
|
lvremove -f $vg/$lv1
|
|
}
|
|
|
|
# FIXME add more topology-specific tests and validation (striped LVs, etc)
|
|
|
|
NUM_DEVS=1
|
|
PER_DEV_SIZE=34
|
|
DEV_SIZE=$(( NUM_DEVS * PER_DEV_SIZE ))
|
|
|
|
# ---------------------------------------------
|
|
# Create "desktop-class" 4K drive
|
|
# (logical_block_size=512, physical_block_size=4096, alignment_offset=0):
|
|
LOGICAL_BLOCK_SIZE=512
|
|
aux prepare_scsi_debug_dev $DEV_SIZE \
|
|
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
|
|
# Test that kernel supports topology
|
|
if [ ! -e "/sys/block/$(basename "$(< SCSI_DEBUG_DEV)")/alignment_offset" ] ; then
|
|
aux cleanup_scsi_debug_dev
|
|
skip
|
|
fi
|
|
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size "$LOGICAL_BLOCK_SIZE"
|
|
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
|
get_devs
|
|
|
|
vgcreate $SHARED $vg "${DEVICES[@]}"
|
|
test_snapshot_mount
|
|
vgremove $vg
|
|
|
|
aux cleanup_scsi_debug_dev
|
|
|
|
# ---------------------------------------------
|
|
# Create "desktop-class" 4K drive w/ 63-sector DOS partition compensation
|
|
# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584):
|
|
LOGICAL_BLOCK_SIZE=512
|
|
aux prepare_scsi_debug_dev $DEV_SIZE \
|
|
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
|
|
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
|
|
|
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
|
vgcreate $SHARED $vg "${DEVICES[@]}"
|
|
test_snapshot_mount
|
|
vgremove $vg
|
|
|
|
aux cleanup_scsi_debug_dev
|
|
|
|
# ---------------------------------------------
|
|
# Create "enterprise-class" 4K drive
|
|
# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0):
|
|
LOGICAL_BLOCK_SIZE=4096
|
|
aux prepare_scsi_debug_dev $DEV_SIZE \
|
|
sector_size=$LOGICAL_BLOCK_SIZE
|
|
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
|
|
|
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
|
vgcreate $SHARED $vg "${DEVICES[@]}"
|
|
test_snapshot_mount
|
|
vgremove $vg
|
|
|
|
aux cleanup_scsi_debug_dev
|
|
|
|
# scsi_debug option opt_blks appeared in Oct 2010
|
|
aux kernel_at_least 2 6 37 || exit 0
|
|
|
|
# ---------------------------------------------
|
|
# Create "enterprise-class" 512 drive w/ HW raid stripe_size = 768K
|
|
# (logical_block_size=512, physical_block_size=512, alignment_offset=0):
|
|
# - tests case where optimal_io_size=768k < default PE alignment=1MB
|
|
LOGICAL_BLOCK_SIZE=512
|
|
aux prepare_scsi_debug_dev $DEV_SIZE \
|
|
sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
|
|
|
|
check sysfs "$(< SCSI_DEBUG_DEV)" queue/logical_block_size $LOGICAL_BLOCK_SIZE
|
|
check sysfs "$(< SCSI_DEBUG_DEV)" queue/optimal_io_size 786432
|
|
|
|
aux prepare_devs 1 $PER_DEV_SIZE
|
|
pvcreate --metadatasize 255s "${DEVICES[@]}"
|
|
|
|
# Kernel (3.19) could provide wrong results - in this case skip
|
|
# test with incorrect result - lvm2 can't figure out good values.
|
|
SHOULD=""
|
|
check sysfs "$dev1" queue/optimal_io_size 786432 || SHOULD=should
|
|
$SHOULD check pv_field "${DEVICES[@]}" pe_start 768.00k
|
|
|
|
aux cleanup_scsi_debug_dev
|