Skip to contentSkip to conversation

f2fs/011: use random data to avoid file compression

PATCH In review Joanne Chang 2 participants 2 messages Oct 30, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
v2:
- changed dd to $XFS_IO_PROG as suggested by Chao Yu

 tests/f2fs/011 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/f2fs/011 +1 -1
index c21cb586..07c94d8c 100755
@@ -36,7 +36,7 @@ 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
+	$XFS_IO_PROG -f -c "pwrite -i /dev/urandom 0 1m" $SCRATCH_MNT/$i >>$seqres.full
 done
 sync
 
Signature · 1 line
2.51.1.930.gacf6e81ea2-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 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/urandom instead to ensure they are not compressed. This way the files take up the same space whether compression is used or not.

Thanks,