mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
7e98d41a6e
Refactor every test in the entire test suite to use the new boilerplate functions. This also migrates all the test group information into the test files. This patch has been autogenerated via the command: ./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
61 lines
1.8 KiB
Bash
Executable File
61 lines
1.8 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2016 Fujitsu. All Rights Reserved.
|
|
#
|
|
# FS QA Test 130
|
|
#
|
|
# Check if btrfs send can handle large deduped file, whose file extents
|
|
# are all pointing to one extent.
|
|
# Such file structure will cause quite large pressure to any operation which
|
|
# iterates all backref of one extent.
|
|
# And unfortunately, btrfs send is one of these operations, and will cause
|
|
# softlock or OOM on systems with small memory(<4G).
|
|
#
|
|
. ./common/preamble
|
|
_begin_fstest auto quick clone send
|
|
|
|
# Import common functions.
|
|
. ./common/filter
|
|
. ./common/reflink
|
|
|
|
# real QA test starts here
|
|
|
|
# Modify as appropriate.
|
|
_supported_fs btrfs
|
|
_require_scratch
|
|
_require_scratch_reflink
|
|
|
|
_scratch_mkfs > /dev/null 2>&1
|
|
_scratch_mount
|
|
|
|
nr_extents=$((256 * $LOAD_FACTOR))
|
|
|
|
# Use 128K blocksize, the default value of both deduperemove or
|
|
# inband dedupe
|
|
blocksize=$((128 * 1024))
|
|
file=$SCRATCH_MNT/foobar
|
|
|
|
echo LOAD_FACTOR=$LOAD_FACTOR nr_extents=$nr_extents blocksize=$blocksize >> $seqres.full
|
|
|
|
# create the initial file, whose file extents are all point to one extent
|
|
_pwrite_byte 0xcdcdcdcd 0 $blocksize $file | _filter_xfs_io
|
|
|
|
for i in $(seq 1 $(($nr_extents - 1))); do
|
|
_reflink_range $file 0 $file $(($i * $blocksize)) $blocksize \
|
|
>> $seqres.full 2>&1
|
|
done
|
|
|
|
# create a RO snapshot, so we can send out the snapshot
|
|
_run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/ro_snap
|
|
|
|
# send out the subvolume, and it will either:
|
|
# 1) OOM since memory is allocated inside a O(n^3) loop
|
|
# 2) Softlock since time consuming backref walk is called without scheduling.
|
|
# the send destination is not important, just send will cause the problem
|
|
echo "# $BTRFS_UTIL_PROG send $SCRATCH_MNT/ro_snap > /dev/null" >> $seqres.full
|
|
$BTRFS_UTIL_PROG send $SCRATCH_MNT/ro_snap > /dev/null 2>>$seqres.full
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|