mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
2e6fb94f99
Pick up the common function _get_max_lfs_filesize() to return MAX_LFS_FILESIZE. Signed-off-by: Yufen Yu <yuyufen@huawei.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
62 lines
1.2 KiB
Bash
Executable File
62 lines
1.2 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2016 Oracle, Inc. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 350
|
|
#
|
|
# Test fallocate(PUNCH_HOLE) on a block device, which should be able to
|
|
# zero-TRIM (or equivalent) the range.
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap "_cleanup; exit \$status" 0 1 2 3 7 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -rf $tmp.*
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
. ./common/scsi_debug
|
|
|
|
# real QA test starts here
|
|
_supported_os Linux
|
|
_require_scsi_debug
|
|
_require_xfs_io_command "fpunch"
|
|
|
|
echo "Create and format"
|
|
dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
|
|
_pwrite_byte 0x62 0 4m $dev >> $seqres.full
|
|
|
|
echo "Zero punch"
|
|
$XFS_IO_PROG -c "fpunch 512k 1m" $dev
|
|
|
|
echo "Punch range past EOD"
|
|
$XFS_IO_PROG -c "fpunch 3m 4m" $dev
|
|
|
|
echo "Check contents"
|
|
md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
|
|
|
|
echo "Punch to MAX_LFS_FILESIZE"
|
|
# zod = MAX_LFS_FILESIZE
|
|
zod=$(_get_max_lfs_filesize)
|
|
$XFS_IO_PROG -c "fpunch 0 $zod" $dev
|
|
|
|
echo "Check contents"
|
|
md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
|
|
|
|
echo "Destroy device"
|
|
_put_scsi_debug_dev
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|