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

Add Async FS #271

Merged
merged 4 commits into from
Aug 12, 2022
Merged

Add Async FS #271

merged 4 commits into from
Aug 12, 2022

Conversation

liqinggd
Copy link
Contributor

@liqinggd liqinggd commented Jun 23, 2022

Need to merge occlum/sefs#43 first

issue: #265

@liqinggd liqinggd force-pushed the dev-add-async-fs branch 5 times, most recently from 5fb57ab to 0877bc3 Compare June 30, 2022 06:25
Copy link
Contributor

@tatetian tatetian left a 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,
Copy link
Contributor

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.

Copy link
Contributor Author

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

src/libos/crates/async-vfs/src/file_handle.rs Outdated Show resolved Hide resolved
dentry: Dentry,
offset: AsyncMutex<usize>,
access_mode: AccessMode,
status_flags: RwLock<StatusFlags>,
Copy link
Contributor

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.

Copy link
Contributor Author

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

src/libos/crates/async-vfs/src/file_handle.rs Outdated Show resolved Hide resolved
src/libos/crates/async-vfs/src/inode.rs Outdated Show resolved Hide resolved
src/libos/crates/async-vfs/src/inode.rs Outdated Show resolved Hide resolved
src/libos/crates/async-vfs/src/inode.rs Outdated Show resolved Hide resolved

/// Sync all data and metadata
async fn sync_all(&self) -> Result<()> {
return_errno!(ENOSYS, "not support");
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

src/libos/crates/async-vfs/src/inode.rs Outdated Show resolved Hide resolved
src/libos/crates/async-vfs/src/inode.rs Outdated Show resolved Hide resolved
@liqinggd liqinggd force-pushed the dev-add-async-fs branch 11 times, most recently from bce8db3 to b8370d1 Compare August 9, 2022 07:47
Copy link
Contributor

@tatetian tatetian left a 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!

@tatetian tatetian merged commit 4f08061 into occlum:master Aug 12, 2022
@liqinggd liqinggd deleted the dev-add-async-fs branch December 12, 2022 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants