1FSCK_OPT=-fn 2OUT=$test_name.log 3EXP=$test_dir/expect 4CONF=$TMPFILE.conf 5 6os=$(uname -s) 7if [ "$os" = "Darwin" -o "$os" = "GNU" -o "FreeBSD" ]; then 8 # creates a 44GB filesystem 9 echo "$test_name: $test_description: skipped for $os" 10 return 0 11fi 12 13cat > $CONF << ENDL 14[fs_types] 15 hugefile = { 16 features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2 17 hash_alg = half_md4 18 num_backup_sb = 0 19 packed_meta_blocks = 1 20 make_hugefiles = 1 21 inode_ratio = 4194304 22 hugefiles_dir = /store 23 hugefiles_name = big-data 24 hugefiles_digits = 0 25 hugefiles_size = 0 26 hugefiles_align = 256M 27 num_hugefiles = 1 28 zero_hugefiles = false 29 flex_bg_size = 262144 30 } 31ENDL 32 33echo "mke2fs -F -T hugefile test.img 4T" > $OUT 34MKE2FS_CONFIG=$CONF $MKE2FS -F -T hugefile $TMPFILE 4T >> $OUT 2>&1 35rm -f $CONF 36 37# check the file system if we get this far, we succeeded... 38$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1 39status=$? 40echo Exit status is $status >> $OUT 41 42echo 'debugfs -R "extents /store/big-data" test.img' >> $OUT 43 44$DEBUGFS -R "extents /store/big-data" $TMPFILE 2>&1 | tr / " " | tr -d - | awk ' 45BEGIN { 46 expected_logical_start = 0; 47 expected_physical_start = 0; 48} 49{ 50 if (NR != 1) { 51 level = $1; 52 total_levels = $2; 53 54 if (level == total_levels) { 55 logical_start=$5; 56 logical_end=$6; 57 physical_start=$7; 58 physical_end=$8; 59 len = $9; 60 61 if (logical_end + 1 - logical_start != len) { 62 print logical_end + 1 - logical_start, len; 63 print "UNEXPECTED LENGTH for extent", $0; 64 } 65 if (physical_end + 1 - physical_start != len) { 66 print physical_end + 1 - physical_start, len; 67 print "UNEXPECTED LENGTH for extent", $0; 68 } 69 70 if (logical_start != expected_logical_start) { 71 print "UNEXPECTED LOGICAL DISCONTINUITY between extents:"; 72 print "\t", prev; 73 print "\t", $0; 74 } 75 if (physical_start != expected_physical_start && 76 expected_logical_start != 0) { 77 print "PHYSICAL DISCONTINUITY between extents:"; 78 print "\t", prev; 79 print "\t", $0; 80 } 81 82 expected_logical_start = logical_end + 1; 83 expected_physical_start = physical_end + 1; 84 } 85 } 86 prev=$0; 87} 88END { 89 print "Last logical block:", expected_logical_start-1; 90 print "Last physical block:", expected_physical_start-1; 91} 92' >> $OUT 2>&1 93 94rm $TMPFILE 95 96# 97# Do the verification 98# 99 100sed -f $cmd_dir/filter.sed $OUT > $OUT.new 101mv $OUT.new $OUT 102 103cmp -s $OUT $EXP 104status=$? 105 106if [ "$status" = 0 ] ; then 107 echo "$test_name: $test_description: ok" 108 touch $test_name.ok 109else 110 echo "$test_name: $test_description: failed" 111 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 112fi 113 114unset IMAGE FSCK_OPT OUT EXP CONF 115