Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not flush on read file handles #1126

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mountpoint-s3/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use time::OffsetDateTime;
use tracing::{debug, trace, Level};

use fuser::consts::FOPEN_DIRECT_IO;
//use fuser::consts::FOPEN_NOFLUSH;
const FUSE_FOPEN_NOFLUSH: u32 = 1 << 5; // c.f. https://github.com/torvalds/linux/blob/master/include/uapi/linux/fuse.h#L372
use fuser::{FileAttr, KernelConfig};
use mountpoint_s3_client::ObjectClient;

Expand Down Expand Up @@ -333,6 +335,7 @@ where
FileHandleState::new_read_handle(&lookup, self).await?
};

let is_read_filehandle = matches!(state, FileHandleState::Read { .. });
let fh = self.next_handle();
let handle = FileHandle {
inode,
Expand All @@ -341,9 +344,9 @@ where
};
debug!(fh, ino, "new file handle created");
self.file_handles.write().await.insert(fh, Arc::new(handle));

let reply_flags = if direct_io { FOPEN_DIRECT_IO } else { 0 };

// TODO: Maybe perform some check against ABI version here (?)
let mut reply_flags = if direct_io { FOPEN_DIRECT_IO } else { 0 };
reply_flags |= if is_read_filehandle { FUSE_FOPEN_NOFLUSH } else { 0 };
Ok(Opened { fh, flags: reply_flags })
}

Expand Down
Loading