Merge branch 'main' into mwp

This commit is contained in:
2026-02-10 20:25:27 -03:00
3 changed files with 16 additions and 9 deletions

View File

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