fix call to fallocate on linux

This commit is contained in:
2026-02-09 15:04:47 +01:00
parent 2b7ab5f570
commit 16c17054e8

View File

@@ -1105,12 +1105,12 @@ pub const FileWriter = struct {
// FALLOC_FL_KEEP_SIZE = 0x01 - allocate without changing file size // FALLOC_FL_KEEP_SIZE = 0x01 - allocate without changing file size
const FALLOC_FL_KEEP_SIZE = 0x01; const FALLOC_FL_KEEP_SIZE = 0x01;
const fd = file.handle; const fd = file.handle;
const result = std.os.linux.syscall(.fallocate, .{ const result = std.os.linux.syscall4(.fallocate,
@as(usize, @intCast(fd)), @as(usize, @intCast(fd)),
@as(usize, FALLOC_FL_KEEP_SIZE), @as(usize, FALLOC_FL_KEEP_SIZE),
@as(usize, 0), // offset @as(usize, 0), // offset
@as(usize, @intCast(size)), @as(usize, @intCast(size)),
}); );
if (result == 0) { if (result == 0) {
std.log.debug("PERF: Pre-allocated {} MB with fallocate", .{size / (1024 * 1024)}); std.log.debug("PERF: Pre-allocated {} MB with fallocate", .{size / (1024 * 1024)});
return; return;