f2fs/011: use random data to avoid file compression
PATCH 1/1 f2fs/011: use random data to avoid file compression
Currently, the created files are filled with 0. When filesystem level compression is used, they take up much less space than expected. So the final fallocate does not show an error.
The created files are filled by /dev/urandom instead to ensure they are not compressed. This way the files take up the same space whether compression is used or not.
--- tests/f2fs/011 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/f2fs/011 +3 -2
@@ -35,8 +35,9 @@ _scratch_mount -o checkpoint=disable:10% pinfile=$SCRATCH_MNT/file # simulate fragment status in f2fs -for ((i=0;i<256;i++)) do - $XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full +dd if=/dev/urandom of=$SCRATCH_MNT/0 bs=1M count=1 2> /dev/null +for ((i=1;i<256;i++)) do + cp $SCRATCH_MNT/0 $SCRATCH_MNT/$i done sync
Signature · 1 line
2.51.1.851.g4ebd6896fd-goog
Joanne,
Quoted 18 lines · Joanne Chang
Currently, the created files are filled with 0. When filesystem level compression is used, they take up much less space than expected. So the final fallocate does not show an error.
The created files are filled by
/dev/urandominstead to ensure they are not compressed. This way the files take up the same space whether compression is used or not.Signed-off-by Joanne Chang <[email protected]>--- tests/f2fs/011 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/f2fs/011 +0
-0
tests/f2fs/011 _scratch_mount -o checkpoint=disable:10% · line 38
Quoted 6 lines
tests/f2fs/011 +1
-2@@ -35,8 +35,9 @@ _scratch_mount -o checkpoint=disable:10% pinfile=$SCRATCH_MNT/file # simulate fragment status in f2fs -for ((i=0;i<256;i++)) do - $XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full +dd if=/dev/urandom of=$SCRATCH_MNT/0 bs=1M count=1 2> /dev/null
IIRC, $XFS_IO_PROG is preferred in xfstests [1]
So, what do you think of this?
for ((i=0;i<256;i++)) do
$XFS_IO_PROG -f -c "pwrite -i /dev/urandom 0 1m" $SCRATCH_MNT/$i >>$seqres.full
done
Quoted 5 lines
tests/f2fs/011 +2
-0+for ((i=1;i<256;i++)) do + cp $SCRATCH_MNT/0 $SCRATCH_MNT/$i done sync
Quoted 19 lines · Chao Yu
Quoted 9 lines · Joanne Chang
--- tests/f2fs/011 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)tests/f2fs/011 +0
-0tests/f2fs/011 _scratch_mount -o checkpoint=disable:10% · line 38
Quoted 6 lines
tests/f2fs/011 +1
-2@@ -35,8 +35,9 @@ _scratch_mount -o checkpoint=disable:10% pinfile=$SCRATCH_MNT/file # simulate fragment status in f2fs -for ((i=0;i<256;i++)) do - $XFS_IO_PROG -f -c "pwrite 0 1m" $SCRATCH_MNT/$i >>$seqres.full +dd if=/dev/urandom of=$SCRATCH_MNT/0 bs=1M count=1 2> /dev/nullIIRC, $XFS_IO_PROG is preferred in xfstests [1]
Quoted 7 lines
So, what do you think of this?
for ((i=0;i<256;i++)) do
$XFS_IO_PROG -f -c "pwrite -i /dev/urandom 0 1m" $SCRATCH_MNT/$i >>$seqres.fulldone
Thanks for the suggestion, Chao. I will send v2 with this change soon.
Quoted 6 lines
Quoted 5 lines
tests/f2fs/011 +2
-0+for ((i=1;i<256;i++)) do + cp $SCRATCH_MNT/0 $SCRATCH_MNT/$i done sync