-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add Async FS #271
Add Async FS #271
Conversation
5fb57ab
to
0877bc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on implementing async file systems. This PR is a major step towards the completion of NGO and improving its file I/O performance.
Given the complexity of this PR, it is unsurprising that one can identify some issues. Actually, I made 50+ comments. I summarize some of the major issues here.
- The page cache must be configurable by the user of this crate. In particular, the page allocator cannot be hardcoded in
AsyncSimpleFs
. - The error handling in file system needs to be more robust. There are some failure points where
Err
is simply returned without rolling back the side effects, leaving inodes or the file system in an inconsistent state. - There are some race conditions that may not be handled.
/// The Dentry is used to speed up the pathname lookup | ||
pub struct Dentry { | ||
inode: Arc<dyn AsyncInode>, | ||
open_path: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unclear whether the open_path
is absolute or it relative to inode
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the path is absolute, change the name to abs_path
dentry: Dentry, | ||
offset: AsyncMutex<usize>, | ||
access_mode: AccessMode, | ||
status_flags: RwLock<StatusFlags>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Atomic<StatusFlags>
seems to be a better choice, as it is more light-weight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the set_status_flags()
method needs to handle the race conditions, so I prefer to use rwlock
|
||
/// Sync all data and metadata | ||
async fn sync_all(&self) -> Result<()> { | ||
return_errno!(ENOSYS, "not support"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think nop is a better default implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
bce8db3
to
b8370d1
Compare
b8370d1
to
d324ee2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the contribution!
Need to merge occlum/sefs#43 first
issue: #265