path: root/tests
diff options
authorLukas Czerner <lczerner@redhat.com>2011-09-15 23:44:59 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-15 23:49:20 -0400
commitd2bfdc7ff15ce7b6b40c087021528ce190ef43c3 (patch)
treeea82b4878bc41543066c26592db48e7a186b65c8 /tests
parentc859cb1de0d624caa0779fb17d1a53766143136e (diff)
e2fsprogs: Use punch hole as "discard" on regular files
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of on block device, we can use punch hole instead of regular discard command which would not work on regular file anyway. This gives us several advantages. First of all when e2fsck is run with '-E discard' parameter it will punch out all ununsed space from the image, hence trimming down the file system image. And secondly, when creating an file system on regular file (with '-E discard' which is default), we can use punch hole to clear the file content, hence we can skip inode table initialization, because reads from sparse area returns zeros. This will result in faster file system creation (without the need to specify lazy_itable_init) and smaller images. This commit also fixes some tests that would fail due to mke2fs showing discard progress, hence the output would differ. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests')
3 files changed, 3 insertions, 2 deletions
diff --git a/tests/f_resize_inode/script b/tests/f_resize_inode/script
index a010fd98..ca934e9e 100644
--- a/tests/f_resize_inode/script
+++ b/tests/f_resize_inode/script
@@ -17,6 +17,7 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT
$MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 \
| sed -e '1d' | grep -v "automatically checked" |
+ grep -v 'Discarding device blocks' |
grep -v "whichever comes first" >> $OUT
$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
diff --git a/tests/m_bigjournal/script b/tests/m_bigjournal/script
index 29e0a242..1e21fdfe 100644
--- a/tests/m_bigjournal/script
+++ b/tests/m_bigjournal/script
@@ -1,4 +1,4 @@
DESCRIPTION="journal over 4GB in size"
-MKE2FS_OPTS="-t ext4 -G 512 -N 1280 -J size=5000 -q -E lazy_journal_init,lazy_itable_init"
+MKE2FS_OPTS="-t ext4 -G 512 -N 1280 -J size=5000 -q -E lazy_journal_init,lazy_itable_init,nodiscard"
. $cmd_dir/run_mke2fs
diff --git a/tests/run_mke2fs b/tests/run_mke2fs
index a3a77432..f5249968 100644
--- a/tests/run_mke2fs
+++ b/tests/run_mke2fs
@@ -11,7 +11,7 @@ MKE2FS_SKIP_PROGRESS=true
-PREP_CMD='$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | tr -d \\015 > $OUT1 ; $DEBUGFS -R features $TMPFILE 2>&1 | sed -e 1d | tr -d \\015 >> $OUT1 ; echo " " >> $OUT1'
+PREP_CMD='$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | grep -v "Discarding device blocks" | tr -d \\015 > $OUT1 ; $DEBUGFS -R features $TMPFILE 2>&1 | sed -e 1d | tr -d \\015 >> $OUT1 ; echo " " >> $OUT1'
AFTER_CMD='$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs | tr -d \\015 >> $OUT1'
. $cmd_dir/run_e2fsck