[LTP] [PATCH 2/2] fallocate05: Deallocate whole file on bcachefs

Martin Doucha mdoucha@suse.cz
Thu Sep 5 15:45:00 CEST 2024


The default deallocation size is likely too small for bcachefs
to actually release the blocks. Since it is also a copy-on-write
filesystem, deallocated the whole file like on Btrfs.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

AFAICT Bcachefs uses 512 byte data blocks by default but 256KB inode
blocks. The whole file will be 128KB and 32KB gets deallocated which may
be too small. However, I'm not entirely sure whether this is the best
solution.

See also https://bugzilla.suse.com/show_bug.cgi?id=1230155

 testcases/kernel/syscalls/fallocate/fallocate05.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fallocate/fallocate05.c b/testcases/kernel/syscalls/fallocate/fallocate05.c
index 979c70d6e..732a2f15d 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate05.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate05.c
@@ -114,7 +114,8 @@ static void run(void)
 	tst_res(TPASS, "fallocate() on full FS");
 
 	/* Btrfs deallocates only complete extents, not individual blocks */
-	if (!strcmp(tst_device->fs_type, "btrfs"))
+	if (!strcmp(tst_device->fs_type, "btrfs") ||
+		!strcmp(tst_device->fs_type, "bcachefs"))
 		holesize = bufsize + extsize;
 	else
 		holesize = DEALLOCATE_BLOCKS * blocksize;
-- 
2.46.0



More information about the ltp mailing list