Home | History | Annotate | Download | only in m_hugefile
      1 FSCK_OPT=-fn
      2 OUT=$test_name.log
      3 EXP=$test_dir/expect
      4 CONF=$TMPFILE.conf
      5 
      6 if [ $(uname -s) = "Darwin" ]; then
      7 	# creates a 4TB filesystem
      8 	echo "$test_name: $DESCRIPTION: skipped for HFS+ (no sparse files)"
      9 	return 0
     10 fi
     11 
     12 if [ $(uname -s) = "FreeBSD" ]; then
     13 	# creates a 4TB filesystem
     14 	echo "$test_name: $DESCRIPTION: skipped for FreeBSD (no sparse files)"
     15 	return 0
     16 fi
     17 
     18 cat > $CONF << ENDL
     19 [fs_types]
     20 	hugefile = {
     21 		features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
     22 		hash_alg = half_md4
     23 		num_backup_sb = 0
     24 		packed_meta_blocks = 1
     25 		make_hugefiles = 1
     26 		inode_ratio = 4194304
     27 		hugefiles_dir = /store
     28 		hugefiles_name = big-data
     29 		hugefiles_digits = 0
     30 		hugefiles_size = 0
     31 		hugefiles_align = 256M
     32 		num_hugefiles = 1
     33 		zero_hugefiles = false
     34 		flex_bg_size = 262144
     35 	}
     36 ENDL
     37 
     38 echo "mke2fs -F -T hugefile test.img 4T" > $OUT
     39 MKE2FS_CONFIG=$CONF $MKE2FS -F -T hugefile $TMPFILE 4T >> $OUT 2>&1
     40 rm -rf $CONF
     41 
     42 # check the file system if we get this far, we succeeded...
     43 $FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
     44 status=$?
     45 echo Exit status is $status >> $OUT
     46 
     47 echo 'debugfs -R "extents /store/big-data" test.img | head' >> $OUT
     48 
     49 $DEBUGFS -R "extents /store/big-data" $TMPFILE 2>&1 | head -n 20 >> $OUT 2>&1
     50 
     51 rm $TMPFILE
     52 
     53 #
     54 # Do the verification
     55 #
     56 
     57 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
     58 mv $OUT.new $OUT
     59 
     60 cmp -s $OUT $EXP
     61 status=$?
     62 
     63 if [ "$status" = 0 ] ; then
     64 	echo "$test_name: $test_description: ok"
     65 	touch $test_name.ok
     66 else
     67 	echo "$test_name: $test_description: failed"
     68 	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
     69 fi
     70 
     71 unset IMAGE FSCK_OPT OUT EXP CONF
     72