Skip to content

Commit ff67a5c

Browse files
authored
feat(io-uring): Fallback to psync engine when sendfile is selected (#562)
1 parent 34468de commit ff67a5c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

riffle-server/src/store/local/uring_io.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ impl LocalIO for UringIo {
466466
path: &str,
467467
options: ReadOptions,
468468
) -> anyhow::Result<DataBytes, WorkerError> {
469+
// if the io_mode is sendfile, we fallback to sync io read
470+
if matches!(options.io_mode, IoMode::SENDFILE) {
471+
// use sendfile via sync io
472+
return self.sync_local_io.read(path, options).await;
473+
}
474+
469475
let (offset, length) = match &options.read_range {
470476
ReadRange::ALL => {
471477
let fs_sts = self.file_stat(path).await?;
@@ -484,7 +490,7 @@ impl LocalIO for UringIo {
484490
let file = OpenOptions::new().read(true).open(path)?;
485491
let raw_fd = file.as_raw_fd();
486492

487-
// make the size as the optional config option in io-uring
493+
// todo: make the size as the optional config option in io-uring
488494
if matches!(options.io_mode, IoMode::SPLICE) && length < 16 * 1024 * 1024 {
489495
// init the pipe
490496
let (pipe_in, mut pipe_out) = {

0 commit comments

Comments
 (0)