> > > > Thanks for the reply. So we can have a small `if` conditional block for xfs > > to have fs size = 500M in generic test cases. > > I'd suggest creating a helper where you pass in the fs size you want and > it rounds that up to the minimum value. That would then get passed to > _scratch_mkfs_sized or _scsi_debug_get_dev. > > (testing this as we speak...) I would be more than happy if you send a patch for this but I also know you are pretty busy, so let me know if you want me to send a patch for this issue. You had something like this in mind? diff --git a/common/config b/common/config index c9771ff9..216e8e06 100644 --- a/common/config +++ b/common/config @@ -168,6 +168,7 @@ export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)" export XFS_SCRUB_PROG="$(type -P xfs_scrub)" export XFS_PARALLEL_REPAIR_PROG="$(type -P xfs_prepair)" export XFS_PARALLEL_REPAIR64_PROG="$(type -P xfs_prepair64)" +export MIN_XFS_FS_SZ_MB=600 export __XFSDUMP_PROG="$(type -P xfsdump)" if [ -n "$__XFSDUMP_PROG" ]; then export XFSDUMP_PROG="$__XFSDUMP_PROG -e" diff --git a/common/rc b/common/rc index 524ffa02..8d148105 100644 --- a/common/rc +++ b/common/rc @@ -916,6 +916,22 @@ _check_minimal_fs_size() fi } +# takes size in MB +_get_optimal_fs_size() +{ + local fssize=$1 + + case "$FSTYP" in + xfs) + [ $MIN_XFS_FS_SZ_MB -gt "$fssize" ] && fssize=$MIN_XFS_FS_SZ_MB + ;; + *) + ;; + esac + + echo "$fssize" +} + # Create fs of certain size on scratch device # _scratch_mkfs_sized <size in bytes> [optional blocksize] _scratch_mkfs_sized() diff --git a/tests/generic/081 b/tests/generic/081 index 22ac94de..650c38be 100755 --- a/tests/generic/081 +++ b/tests/generic/081 @@ -62,13 +62,15 @@ snapname=snap_$seq mnt=$TEST_DIR/mnt_$seq mkdir -p $mnt -# make sure there's enough disk space for 256M lv, test for 300M here in case +size=$(_get_optimal_fs_size 300) # lvm uses some space for metadata -_scratch_mkfs_sized $((300 * 1024 * 1024)) >>$seqres.full 2>&1 +lvmsize=$((size - 50)) +# make sure there's enough disk space for 256M lv, test for 300M here in case +_scratch_mkfs_sized $(($size * 1024 * 1024)) >>$seqres.full 2>&1 $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm # (like 2.02.95 in RHEL6) don't support --yes option -yes | $LVM_PROG lvcreate -L 256M -n $lvname $vgname >>$seqres.full 2>&1 +yes | $LVM_PROG lvcreate -L "$lvmsize"M -n $lvname $vgname >>$seqres.full 2>&1 # wait for lvcreation to fully complete $UDEV_SETTLE_PROG >>$seqres.full 2>&1 diff --git a/tests/generic/108 b/tests/generic/108 index efe66ba5..a17ee435 100755 --- a/tests/generic/108 +++ b/tests/generic/108 @@ -45,8 +45,11 @@ vgname=vg_$seq physical=`blockdev --getpbsz $SCRATCH_DEV` logical=`blockdev --getss $SCRATCH_DEV` +size=$(_get_optimal_fs_size 300) +# lvm uses some space for metadata +lvmsize=$((size - 50)) # _get_scsi_debug_dev returns a scsi debug device with 128M in size by default -SCSI_DEBUG_DEV=`_get_scsi_debug_dev ${physical:-512} ${logical:-512} 0 300` +SCSI_DEBUG_DEV=`_get_scsi_debug_dev ${physical:-512} ${logical:-512} 0 $size` test -b "$SCSI_DEBUG_DEV" || _notrun "Failed to initialize scsi debug device" echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full @@ -55,7 +58,7 @@ $LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1 $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm # (like 2.02.95 in RHEL6) don't support --yes option -yes | $LVM_PROG lvcreate -i 2 -I 4m -L 275m -n $lvname $vgname \ +yes | $LVM_PROG lvcreate -i 2 -I 4m -L "$lvmsize"m -n $lvname $vgname \ >>$seqres.full 2>&1 # wait for lv creation to fully complete $UDEV_SETTLE_PROG >>$seqres.full 2>&1