Skip to contentSkip to conversation

common/rc: add _require_blocks_in_file helper

PATCH Superseded Joanne Chang 3 participants 5 messages Dec 29, 2025 – Jan 7

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common/rc: add _require_blocks_in_file helper

generic/735 attempts to create a file with nearly 2^32 blocks. However, some filesystems have a maximum file block limit below this threshold. For instance, F2FS is limited to approximately 2^30 blocks due to the capacity of the inode. So add _require_blocks_in_file helper to skip the test in such cases.

---
v1 -> v2:
- changed title from "generic/735: disable for f2fs"
- used a new helper function instead of _exclude_fs as Christoph Hellwig suggested

 common/rc         | 16 ++++++++++++++++
 tests/generic/735 |  1 +
 2 files changed, 17 insertions(+)
common/rc +16 -0
index c3cdc220..e92f4854 100644
@@ -6120,6 +6120,22 @@ _require_file_attr_special()
 	fi
 }
 
+# Require filesystem to accomodate enough blocks in a file
+_require_blocks_in_file()
+{
+	local blocks=$1
+
+	case $FSTYP in
+	f2fs)
+		if [ $blocks -gt 1057053439 ]; then
+			_notrun "$blocks blocks per file not supported on $FSTYP"
+		fi
+		;;
+	*)
+		;;
+	esac
+}
+
 ################################################################################
 # make sure this script returns success
 /bin/true
tests/generic/735 +1 -0
index 9bbdf3a1..2fbf125c 100755
@@ -22,6 +22,7 @@ fi
 _require_odirect
 _require_xfs_io_command "falloc"
 _require_xfs_io_command "finsert"
+_require_blocks_in_file $(( (1 << 32) - 1 ))
 
 dev_size=$((80 * 1024 * 1024))
 _scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Joanne Chang

generic/735 attempts to create a file with nearly 2^32 blocks. However, some filesystems have a maximum file block limit below this threshold. For instance, F2FS is limited to approximately 2^30 blocks due to the capacity of the inode. So add _require_blocks_in_file helper to skip the test in such cases.

Thanks,

#2 lore raw
In reply to Joanne Chang
Quoted 5 lines · Joanne Chang

generic/735 attempts to create a file with nearly 2^32 blocks. However, some filesystems have a maximum file block limit below this threshold. For instance, F2FS is limited to approximately 2^30 blocks due to the capacity of the inode. So add _require_blocks_in_file helper to skip the test in such cases.

I still don't understand why we can't do this programmatically. I guess it would be simply too slow? In that case that should probably be documented here in the commit log. Otherwise this looks good to me.

#3 lore raw
Quoted 3 lines · Christoph Hellwig

I still don't understand why we can't do this programmatically. I guess it would be simply too slow? In that case that should probably be documented here in the commit log. Otherwise this looks good to me.

I used a constant to avoid masking bugs that cause the maximum file size to shrink on filesystems that should support this test. I can add the reason to the commit message if that would make it clearer.

Best regards,
Joanne

#4 lore raw
Quoted 8 lines · Joanne Chang
Quoted 3 lines · Christoph Hellwig

I still don't understand why we can't do this programmatically. I guess it would be simply too slow? In that case that should probably be documented here in the commit log. Otherwise this looks good to me.

I used a constant to avoid masking bugs that cause the maximum file size to shrink on filesystems that should support this test. I can add the reason to the commit message if that would make it clearer.

That would be great, thanks!