summaryrefslogtreecommitdiffstats
path: root/tests/f_extent_htree
diff options
context:
space:
mode:
Diffstat (limited to 'tests/f_extent_htree')
-rw-r--r--tests/f_extent_htree/expect.129
-rw-r--r--tests/f_extent_htree/expect.27
-rw-r--r--tests/f_extent_htree/expect.pre.129
-rw-r--r--tests/f_extent_htree/expect.pre.27
-rw-r--r--tests/f_extent_htree/name1
-rw-r--r--tests/f_extent_htree/script56
6 files changed, 129 insertions, 0 deletions
diff --git a/tests/f_extent_htree/expect.1 b/tests/f_extent_htree/expect.1
new file mode 100644
index 0000000..63d1415
--- /dev/null
+++ b/tests/f_extent_htree/expect.1
@@ -0,0 +1,29 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+
+ 352 inodes used (29.53%, out of 1192)
+ 0 non-contiguous files (0.0%)
+ 1 non-contiguous directory (0.3%)
+ # of inodes with ind/dind/tind blocks: 0/0/0
+ Extent depth histogram: 342/1
+ 778 blocks used (65.38%, out of 1190)
+ 0 bad blocks
+ 0 large files
+
+ 340 regular files
+ 3 directories
+ 0 character device files
+ 0 block device files
+ 0 fifos
+ 0 links
+ 0 symbolic links (0 fast symbolic links)
+ 0 sockets
+------------
+ 343 files
+Exit status is 0
diff --git a/tests/f_extent_htree/expect.2 b/tests/f_extent_htree/expect.2
new file mode 100644
index 0000000..7c0ef95
--- /dev/null
+++ b/tests/f_extent_htree/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 352/1192 files (0.3% non-contiguous), 778/1190 blocks
+Exit status is 0
diff --git a/tests/f_extent_htree/expect.pre.1 b/tests/f_extent_htree/expect.pre.1
new file mode 100644
index 0000000..fb0e84a
--- /dev/null
+++ b/tests/f_extent_htree/expect.pre.1
@@ -0,0 +1,29 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+
+ 522 inodes used (43.79%, out of 1192)
+ 0 non-contiguous files (0.0%)
+ 1 non-contiguous directory (0.2%)
+ # of inodes with ind/dind/tind blocks: 0/0/0
+ Extent depth histogram: 512/1
+ 1007 blocks used (84.62%, out of 1190)
+ 0 bad blocks
+ 0 large files
+
+ 510 regular files
+ 3 directories
+ 0 character device files
+ 0 block device files
+ 0 fifos
+ 0 links
+ 0 symbolic links (0 fast symbolic links)
+ 0 sockets
+------------
+ 513 files
+Exit status is 0
diff --git a/tests/f_extent_htree/expect.pre.2 b/tests/f_extent_htree/expect.pre.2
new file mode 100644
index 0000000..54beb0e
--- /dev/null
+++ b/tests/f_extent_htree/expect.pre.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 522/1192 files (0.2% non-contiguous), 1007/1190 blocks
+Exit status is 0
diff --git a/tests/f_extent_htree/name b/tests/f_extent_htree/name
new file mode 100644
index 0000000..fc3812d
--- /dev/null
+++ b/tests/f_extent_htree/name
@@ -0,0 +1 @@
+htree extent compression
diff --git a/tests/f_extent_htree/script b/tests/f_extent_htree/script
new file mode 100644
index 0000000..fb24a63
--- /dev/null
+++ b/tests/f_extent_htree/script
@@ -0,0 +1,56 @@
+#!/bin/bash
+TMPDIR=${TMPDIR:-"/tmp"}
+OUT=$test_name.log
+
+FSCK_OPT="-fyvD"
+SKIP_GUNZIP="true"
+
+NAMELEN=250
+SRC=$TMPDIR/$test_name.tmp
+SUB=subdir
+BASE=$SRC/$SUB/$(yes | tr -d '\n' | dd bs=$NAMELEN count=1 2> /dev/null)
+TMPFILE=${TMPFILE:-"$TMPDIR/image"}
+BSIZE=1024
+
+> $OUT
+mkdir -p $SRC/$SUB
+# calculate the number of files needed to create the directory extent tree
+# deep enough to exceed the in-inode index and spill into an index block.
+#
+# dirents per block * extents per block * (index blocks > i_blocks)
+NUM=$(((BSIZE / (NAMELEN + 8)) * (BSIZE / 12) * 2))
+# Create source files. Unfortunately hard links will be copied as links,
+# and blocks with only NULs will be turned into holes.
+if [ ! -f $BASE.1 ]; then
+ for N in $(seq $NUM); do
+ echo "foo" > $BASE.$N
+ done >> $OUT
+fi
+
+# make filesystem with enough inodes and blocks to hold all the test files
+> $TMPFILE
+NUM=$((NUM * 7 / 3))
+echo "mke2fs -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM" >> $OUT
+$MKE2FS -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM >> $OUT 2>&1
+rm -r $SRC
+
+# Run e2fsck to convert dir to htree before deleting the files, as mke2fs
+# doesn't do this. Run second e2fsck to verify there is no corruption yet.
+(
+ EXP1=$test_dir/expect.pre.1
+ EXP2=$test_dir/expect.pre.2
+ OUT1=$test_name.pre.1.log
+ OUT2=$test_name.pre.2.log
+ DESCRIPTION="$(cat $test_dir/name) setup"
+ . $cmd_dir/run_e2fsck
+)
+
+# generate a list of filenames for debugfs to delete, one from each leaf block
+DELETE_LIST=$TMPDIR/delete.$$
+$DEBUGFS -c -R "htree subdir" $TMPFILE 2>> $OUT |
+ grep -A2 "Reading directory block" |
+ awk '/yyyyy/ { print "rm '$SUB'/"$4 }' > $DELETE_LIST
+$DEBUGFS -w -f $DELETE_LIST $TMPFILE >> $OUT 2>&1
+rm $DELETE_LIST
+
+. $cmd_dir/run_e2fsck