local sectorsize=$1
# PAGE_SIZE as sectorsize is always supported
- if [ $sectorsize -eq $(get_page_size) ]; then
+ if [ $sectorsize -eq $(_get_page_size) ]; then
return
fi
_filter_xfs_io_pages_modified()
{
- PAGE_SIZE=$(get_page_size)
+ PAGE_SIZE=$(_get_page_size)
_filter_xfs_io_units_modified "Page" $PAGE_SIZE
}
if ! [[ $blocksize =~ $re ]] ; then
_notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer."
fi
- if [ $blocksize -lt $(get_page_size) ]; then
+ if [ $blocksize -lt $(_get_page_size) ]; then
_exclude_scratch_mount_option dax
fi
_scratch_mount
# Minimum size for mkswap is 10 pages
- _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
+ _format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
# ext* has supported all variants of swap files since their
# introduction, so swapon should not fail.
_notrun "File allocation unit is larger than a filesystem block"
}
-get_page_size()
+_get_page_size()
{
echo $(getconf PAGE_SIZE)
}
# Therefore, we default to merkle_tree_block_size == min(fs_block_size,
# page_size). That maximizes the chance of verity actually working.
local fs_block_size=$(_get_block_size $scratch_mnt)
- local page_size=$(get_page_size)
+ local page_size=$(_get_page_size)
if (( fs_block_size <= page_size )); then
FSV_BLOCK_SIZE=$fs_block_size
else
swapfile="$SCRATCH_MNT/swap"
_scratch_pool_mkfs >/dev/null
_scratch_mount
-_format_swapfile "$swapfile" $(($(get_page_size) * 10)) >/dev/null
+_format_swapfile "$swapfile" $(($(_get_page_size) * 10)) >/dev/null
check_exclusive_ops()
{
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount $mount_opts
- PAGE_SIZE=$(get_page_size)
+ PAGE_SIZE=$(_get_page_size)
# Create our test file with 16 pages worth of data in a single extent
# that is going to be compressed no matter which compression algorithm
rm -f "$SCRATCH_MNT/swap"
touch "$SCRATCH_MNT/swap"
chmod 0600 "$SCRATCH_MNT/swap"
-_pwrite_byte 0x61 0 $(($(get_page_size) * 10)) "$SCRATCH_MNT/swap" >> $seqres.full
+_pwrite_byte 0x61 0 $(($(_get_page_size) * 10)) "$SCRATCH_MNT/swap" >> $seqres.full
$MKSWAP_PROG "$SCRATCH_MNT/swap" >> $seqres.full
swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
echo "Compressed file"
rm -f "$SCRATCH_MNT/swap"
-_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
+_format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
$CHATTR_PROG +c "$SCRATCH_MNT/swap" 2>&1 | grep -o "Invalid argument while setting flags"
status=0
$BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/swapvol" >> $seqres.full
swapfile="$SCRATCH_MNT/swapvol/swap"
-_format_swapfile "$swapfile" $(($(get_page_size) * 10)) > /dev/null
+_format_swapfile "$swapfile" $(($(_get_page_size) * 10)) > /dev/null
swapon "$swapfile"
# Turning off nocow doesn't do anything because the file is not empty, not
_check_minimal_fs_size $((1024 * 1024 * 1024))
cycle_swapfile() {
- local sz=${1:-$(($(get_page_size) * 10))}
+ local sz=${1:-$(($(_get_page_size) * 10))}
_format_swapfile "$SCRATCH_MNT/swap" "$sz" > /dev/null
swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1
_scratch_mount
# Create the swap file, then add the device. That way we know it's all on one
# device.
-_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
+_format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | $AWK_PROG '{ print $2 }')"
$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
echo "Remove device"
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
-_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
+_format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
# We know the swap file is on device 1 because we added device 2 after it was
echo "Replace device"
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
-_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
+_format_swapfile "$SCRATCH_MNT/swap" $(($(_get_page_size) * 10)) > /dev/null
$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
# Again, we know the swap file is on device 1.
_require_attrs
# We require a 4K nodesize to ensure the test isn't too slow
-if [ $(get_page_size) -ne 4096 ]; then
+if [ $(_get_page_size) -ne 4096 ]; then
_notrun "This test doesn't support non-4K page size yet"
fi
# blobk group
_scratch_mount $(_btrfs_no_v1_cache_opt)
-pagesize=$(get_page_size)
+pagesize=$(_get_page_size)
blocksize=$(_get_block_size $SCRATCH_MNT)
# For subpage case, since we still do read in full page size, if have 8 corrupted
_supported_fs btrfs
_require_scratch
-pagesize=$(get_page_size)
+pagesize=$(_get_page_size)
# Read the content from urandom to a known safe location
$XFS_IO_PROG -f -c "pwrite -i /dev/urandom 0 $pagesize" "$tmp.good" > /dev/null
dev2=`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`
-pagesize=$(get_page_size)
+pagesize=$(_get_page_size)
blocksize=$(_get_block_size $SCRATCH_MNT)
sectors_per_page=$(($pagesize / $blocksize))
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol | _filter_scratch
echo "Creating and activating swap file..."
-_format_swapfile $swap_file $(($(get_page_size) * 32)) >> $seqres.full
+_format_swapfile $swap_file $(($(_get_page_size) * 32)) >> $seqres.full
_swapon_file $swap_file
echo "Attempting to delete subvolume with swap file enabled..."
_scratch_mount
swap_file="$SCRATCH_MNT/swapfile"
-_format_swapfile $swap_file $(($(get_page_size) * 64)) >> $seqres.full
+_format_swapfile $swap_file $(($(_get_page_size) * 64)) >> $seqres.full
echo "Creating first snapshot..."
$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap1 | _filter_scratch
_require_scratch
_require_scratch_ext4_feature "bigalloc"
-BLOCK_SIZE=$(get_page_size)
+BLOCK_SIZE=$(_get_page_size)
features=bigalloc
if echo "${MOUNT_OPTIONS}" | grep -q 'test_dummy_encryption' ; then
features+=",encrypt"
# Block size
BLOCK_SIZE=4096
-if [[ $(get_page_size) -ne $BLOCK_SIZE ]]; then
+if [[ $(_get_page_size) -ne $BLOCK_SIZE ]]; then
_exclude_scratch_mount_option dax
fi
# Use large inodes to have enough space for experimentation
features+=",encrypt"
fi
-blksz=$(get_page_size)
+blksz=$(_get_page_size)
$MKFS_EXT4_PROG -F -b $blksz -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
_scratch_mount
_require_scratch
fs_size=$((128 * 1024 * 1024))
-page_size=$(get_page_size)
+page_size=$(_get_page_size)
# We will never reach this number though
nr_files=$(($fs_size / $page_size))
# Create a ridiculously small swap file. Each swap file must have at least
# two pages after the header page.
echo "tiny swap" | tee -a $seqres.full
-swapfile_cycle $swapfile $(($(get_page_size) * 3))
+swapfile_cycle $swapfile $(($(_get_page_size) * 3))
status=0
exit
touch "$SCRATCH_MNT/swap"
$CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
chmod 0600 "$SCRATCH_MNT/swap"
-$XFS_IO_PROG -c "truncate $(($(get_page_size) * 10))" "$SCRATCH_MNT/swap"
+$XFS_IO_PROG -c "truncate $(($(_get_page_size) * 10))" "$SCRATCH_MNT/swap"
"$here/src/mkswap" "$SCRATCH_MNT/swap"
"$here/src/swapon" "$SCRATCH_MNT/swap"
swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
swapfile=$SCRATCH_MNT/swap
len=$((2 * 1048576))
-page_size=$(get_page_size)
+page_size=$(_get_page_size)
swapfile_cycle() {
local swapfile="$1"
swapfile=$SCRATCH_MNT/swap
len=$((2 * 1048576))
-page_size=$(get_page_size)
+page_size=$(_get_page_size)
swapfile_cycle() {
local swapfile="$1"
round_up_to_page_boundary()
{
local n=$1
- local page_size=$(get_page_size)
+ local page_size=$(_get_page_size)
echo $(( (n + page_size - 1) & ~(page_size - 1) ))
}
touch "$SCRATCH_MNT/swap"
$CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
chmod 0600 "$SCRATCH_MNT/swap"
-_pwrite_byte 0x61 0 $(get_page_size) "$SCRATCH_MNT/swap" >> $seqres.full
+_pwrite_byte 0x61 0 $(_get_page_size) "$SCRATCH_MNT/swap" >> $seqres.full
"$here/src/mkswap" "$SCRATCH_MNT/swap"
"$here/src/swapon" "$SCRATCH_MNT/swap"
swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
-psize=`get_page_size`
+psize=`_get_page_size`
bsize=`_get_file_block_size $SCRATCH_MNT`
# Due to we need page-unaligned blocks, so blocksize < pagesize is necessary.
# If not, try to make a smaller enough block size
# Test allocsize=size
# Valid values for this option are page size (typically 4KiB) through to 1GiB
do_mkfs
-pagesz=$(get_page_size)
+pagesz=$(_get_page_size)
if [ $pagesz -ge 1024 ];then
pagesz="$((pagesz / 1024))k"
fi
echo "Create the original files"
nr=16
-blksz=$(get_page_size)
+blksz=$(_get_page_size)
_pwrite_byte 0x61 0 $((blksz * nr)) $testdir/testfile >> $seqres.full
_pwrite_byte 0x62 0 $((blksz * nr)) $testdir/poisonfile >> $seqres.full
seq 0 2 $((nr - 1)) | while read i; do
_require_pagecache_access $SCRATCH_MNT
blocks=10
-blksz=$(get_page_size)
+blksz=$(_get_page_size)
filesz=$((blocks * blksz))
dirty_offset=$(( filesz - 1 ))
write_len=$(( ( (blocks - 1) * blksz) + 1 ))