mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
fstests: use get_block_size helper
Don't open code grabbing the block size; just use the helper. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
3ea91b080b
commit
fff869cb9c
+1
-1
@@ -55,7 +55,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -59,7 +59,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
free_blocks0=$(stat -f $testdir -c '%f')
|
free_blocks0=$(stat -f $testdir -c '%f')
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ rm -rf $testdir
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Create the original file blocks"
|
echo "Create the original file blocks"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
blks=2000
|
blks=2000
|
||||||
margin='15%'
|
margin='15%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ testdir2=$SCRATCH_MNT/test-$seq
|
|||||||
mkdir $testdir2
|
mkdir $testdir2
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
blksz="$(stat -f $testdir1 -c '%S')"
|
blksz="$(get_block_size $testdir1)"
|
||||||
blks=1000
|
blks=1000
|
||||||
margin='7%'
|
margin='7%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ testdir2=$SCRATCH_MNT/test-$seq
|
|||||||
mkdir $testdir2
|
mkdir $testdir2
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
blksz="$(stat -f $testdir1 -c '%S')"
|
blksz="$(get_block_size $testdir1)"
|
||||||
blks=1000
|
blks=1000
|
||||||
margin='7%'
|
margin='7%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ rm -rf $testdir1
|
|||||||
mkdir $testdir1
|
mkdir $testdir1
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
blksz="$(stat -f $testdir1 -c '%S')"
|
blksz="$(get_block_size $testdir1)"
|
||||||
blks=1000
|
blks=1000
|
||||||
margin='7%'
|
margin='7%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ rm -rf $testdir1
|
|||||||
mkdir $testdir1
|
mkdir $testdir1
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
blksz="$(stat -f $testdir1 -c '%S')"
|
blksz="$(get_block_size $testdir1)"
|
||||||
blks=1000
|
blks=1000
|
||||||
margin='7%'
|
margin='7%'
|
||||||
sz=$((blksz * blks))
|
sz=$((blksz * blks))
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ testdir=$SCRATCH_MNT/test-$seq
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Reformat with appropriate size"
|
echo "Reformat with appropriate size"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
nr_blks=10240
|
nr_blks=10240
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
sz_bytes=$((nr_blks * 8 * blksz))
|
sz_bytes=$((nr_blks * 8 * blksz))
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ testdir=$SCRATCH_MNT/test-$seq
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Reformat with appropriate size"
|
echo "Reformat with appropriate size"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
nr_blks=10240
|
nr_blks=10240
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
sz_bytes=$((nr_blks * 8 * blksz))
|
sz_bytes=$((nr_blks * 8 * blksz))
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ testdir=$SCRATCH_MNT/test-$seq
|
|||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
echo "Reformat with appropriate size"
|
echo "Reformat with appropriate size"
|
||||||
blksz="$(stat -f $testdir -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
nr_blks=10240
|
nr_blks=10240
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
sz_bytes=$((nr_blks * 8 * blksz))
|
sz_bytes=$((nr_blks * 8 * blksz))
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ testdir="$SCRATCH_MNT/test-$seq"
|
|||||||
mkdir "$testdir"
|
mkdir "$testdir"
|
||||||
|
|
||||||
echo "Create a one block file"
|
echo "Create a one block file"
|
||||||
blksz="$(stat -f "$testdir" -c '%S')"
|
blksz="$(get_block_size $testdir)"
|
||||||
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
|
_pwrite_byte 0x61 0 $blksz "$testdir/file1" >> "$seqres.full"
|
||||||
|
|
||||||
fnr=19
|
fnr=19
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ mkdir "$testdir"
|
|||||||
# 2^17 blocks... that should be plenty for anyone.
|
# 2^17 blocks... that should be plenty for anyone.
|
||||||
fnr=20
|
fnr=20
|
||||||
free_blocks=$(stat -f -c '%a' "$testdir")
|
free_blocks=$(stat -f -c '%a' "$testdir")
|
||||||
blksz=$(stat -f -c '%S' "$testdir")
|
blksz=$(get_block_size "$testdir")
|
||||||
space_avail=$((free_blocks * blksz))
|
space_avail=$((free_blocks * blksz))
|
||||||
calc_space() {
|
calc_space() {
|
||||||
blocks_needed=$(( 2 ** (fnr + 1) ))
|
blocks_needed=$(( 2 ** (fnr + 1) ))
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ _scratch_mount >> $seqres.full 2>&1
|
|||||||
testdir=$SCRATCH_MNT/test-$seq
|
testdir=$SCRATCH_MNT/test-$seq
|
||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
real_blksz=$(stat -f -c '%S' $testdir)
|
real_blksz=$(get_block_size $testdir)
|
||||||
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
|
|||||||
testdir=$SCRATCH_MNT/test-$seq
|
testdir=$SCRATCH_MNT/test-$seq
|
||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
real_blksz=$(stat -f -c '%S' $testdir)
|
real_blksz=$(get_block_size $testdir)
|
||||||
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ _scratch_mount >> $seqres.full 2>&1
|
|||||||
testdir=$SCRATCH_MNT/test-$seq
|
testdir=$SCRATCH_MNT/test-$seq
|
||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
real_blksz=$(stat -f -c '%S' $testdir)
|
real_blksz=$(get_block_size $testdir)
|
||||||
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ _scratch_mount >> $seqres.full 2>&1
|
|||||||
testdir=$SCRATCH_MNT/test-$seq
|
testdir=$SCRATCH_MNT/test-$seq
|
||||||
mkdir $testdir
|
mkdir $testdir
|
||||||
|
|
||||||
real_blksz=$(stat -f -c '%S' $testdir)
|
real_blksz=$(get_block_size $testdir)
|
||||||
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
test $real_blksz != $blksz && _notrun "Failed to format with small blocksize."
|
||||||
|
|
||||||
echo "Create the original files"
|
echo "Create the original files"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user