1 test_description="test prezeroed storage metadata allocation"
8 if test "$(id -u)" -ne 0 ; then
9 echo "$test_name: $test_description: skipped (not root)"
10 elif ! command -v losetup >/dev/null ; then
11 echo "$test_name: $test_description: skipped (no losetup)"
13 dd if=/dev/zero of=$TMPFILE.1 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1
14 dd if=/dev/zero of=$TMPFILE.2 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1
16 LOOP1=$(losetup --show --sector-size 4096 -f $TMPFILE.1)
17 if [ ! -b "$LOOP1" ]; then
18 echo "$test_name: $DESCRIPTION: skipped (no loop devices)"
19 rm -f $TMPFILE.1 $TMPFILE.2
22 LOOP2=$(losetup --show --sector-size 4096 -f $TMPFILE.2)
23 if [ ! -b "$LOOP2" ]; then
24 echo "$test_name: $DESCRIPTION: skipped (no loop devices)"
25 rm -f $TMPFILE.1 $TMPFILE.2
30 echo $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1
31 $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1
33 stat $TMPFILE.1 >> $LOG 2>&1
34 SZ=$(stat -c "%b" $TMPFILE.1)
35 if test $SZ -gt 10000 ; then
41 echo $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1
42 $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1
44 stat $TMPFILE.2 >> $LOG 2>&1
45 stat -c "%b" $TMPFILE.2 >> $OUT
49 rm -f $TMPFILE.1 $TMPFILE.2
54 if [ "$status" = 0 ] ; then
55 echo "$test_name: $test_description: ok"
58 echo "$test_name: $test_description: failed"
59 cat $LOG > $test_name.failed
60 diff $EXP $OUT >> $test_name.failed
63 unset LOG OUT EXP FILE_SIZE LOOP1 LOOP2