Skip to content

Commit

Permalink
fallocate fails beyond 4GiB (#3)
Browse files Browse the repository at this point in the history
Without this cast, extending the output file wraps after the first 4GiB.
The result of the ALIGN_FWD is treated as a 32-bit unsigned, and so
the second argument to fallocate_fn is negative.
  • Loading branch information
rgarner-vivcourt authored Mar 19, 2024
1 parent 9db3a02 commit c893371
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/sc_perf_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ static void sc_async_writer_submit_list(struct sc_node* node,
struct iocb *iocbs_to_submit[MAX_SUBMIT];

if( ((int64_t)(st->file_write_offset) > (int64_t)st->file_size - ALLOC_STRIDE/8 )) {
st->alloc_till = ALIGN_FWD(st->file_size + 1, ALLOC_STRIDE);
st->alloc_till = ALIGN_FWD(st->file_size + 1, (uint64_t)ALLOC_STRIDE);
fallocate_fn(st->fd, 0, st->file_size, st->alloc_till - st->file_size);
st->file_size = st->alloc_till;
}
Expand Down

0 comments on commit c893371

Please sign in to comment.