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

Introduce the common module. #84

Merged
merged 5 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ log = "0.4.6"
mio = { version = "0.8", features = ["os-poll", "os-ext"]}
nix = "0.24"
lazy_static = "1.4"
tokio-uring = { version = "0.3.0", optional = true }
tokio = { version = "1", optional = true }
vmm-sys-util = { version = "0.9", optional = true }
vm-memory = { version = "0.8", features = ["backend-mmap"] }
virtio-queue = { version = "0.4", optional = true }
Expand All @@ -37,16 +37,22 @@ core-foundation-sys = { version = ">=0.8", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
caps = { version = "0.3", optional = true }
tokio-uring = "0.3.0"
io-uring = { version = "0.5.2", features = ["unstable"] }
socket2 = { version = "0.4.4", features = ["all"] }
scoped-tls = "1.0.0"
slab = "0.4.6"

[dev-dependencies]
futures = { version = "0.3", features = ["thread-pool"]}
stderrlog = "0.5"
vmm-sys-util = "0.9"
vm-memory = { version = "0.8", features = ["backend-mmap", "backend-bitmap"] }
tokio-test = "0.4.2"

[features]
default = ["fusedev"]
async-io = ["async-trait", "futures", "tokio-uring"]
async-io = ["async-trait", "futures", "tokio/fs", "tokio/net", "tokio/sync", "tokio/rt", "tokio/macros"]
fusedev = ["vmm-sys-util", "caps", "core-foundation-sys"]
virtiofs = ["virtio-queue", "caps"]
vhost-user-fs = ["virtiofs", "vhost", "caps"]
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,10 @@ impl FuseServer {
This project is licensed under
- [Apache License](http://www.apache.org/licenses/LICENSE-2.0), Version 2.0
- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause)

Source code under [src/tokio-uring] is temporarily copied from [tokio-uring](https://github.com/tokio-rs/tokio-uring)
with modifications, which is licensed under [MIT](https://github.com/tokio-rs/tokio-uring/blob/master/LICENSE).
Copy link
Contributor

@bergwolf bergwolf Jul 13, 2022

Choose a reason for hiding this comment

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

Could you list corresponding upstream tokio-uring PRs? So that we can drop the code once the changes are merged.

Also, another way (other than copying the code here) is to fork tokio-uring somewhere and make fuse-backend-rs depend on the fork temporarily. The advantage is that it would be clear what is changed from tokio-uring and it's possible to rebase/merge tokio-uring upstream changes while the proposed changes are still under review.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we temporarily fork the tokio-uring crate, we must publish that forked tokio-uring crate before we could publish the fuse-backend-rs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

crates.io does not allow packages to be published with git dependencies and path dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, I see. Let's live with it in fuse-backend-rs then. But still, please list out the ongoing tokio-uring PRs so that we know when to drop the in-tree tokio-uring later on. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added
Please reveiw again.


We will use `crate.io` directly instead of this temporary copy when the pendding PRs is merged.
https://github.com/tokio-rs/tokio-uring/pull/87
https://github.com/tokio-rs/tokio-uring/pull/88
2 changes: 1 addition & 1 deletion src/api/filesystem/async_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use async_trait::async_trait;

use super::{Context, Entry, FileSystem, ZeroCopyReader, ZeroCopyWriter};
use crate::abi::fuse_abi::{stat64, CreateIn, OpenOptions, SetattrValid};
use crate::transport::AsyncFileReadWriteVolatile;
use crate::file_traits::AsyncFileReadWriteVolatile;

/// A trait for directly copying data from the fuse transport into a `File` without first storing it
/// in an intermediate buffer in asynchronous mode.
Expand Down
2 changes: 1 addition & 1 deletion src/api/filesystem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::io;
use std::time::Duration;

use crate::abi::fuse_abi as fuse;
use crate::transport::FileReadWriteVolatile;
use crate::file_traits::FileReadWriteVolatile;

pub use fuse::FsOptions;
pub use fuse::OpenOptions;
Expand Down
7 changes: 3 additions & 4 deletions src/api/server/async_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ use crate::api::filesystem::{
use crate::api::server::{
MetricsHook, Server, ServerUtil, SrvContext, BUFFER_HEADER_SIZE, MAX_BUFFER_SIZE,
};
use crate::transport::{
AsyncFileReadWriteVolatile, FileReadWriteVolatile, FsCacheReqHandler, Reader, Writer,
};
use crate::file_traits::{AsyncFileReadWriteVolatile, FileReadWriteVolatile};
use crate::transport::{FsCacheReqHandler, Reader, Writer};
use crate::{bytes_to_cstr, encode_io_error_kind, BitmapSlice, Error, Result};

struct AsyncZcReader<'a, S: BitmapSlice = ()>(Reader<'a, S>);
Expand Down Expand Up @@ -605,7 +604,7 @@ mod tests {
.unwrap()
.into();

let result = tokio_uring::start(async {
let result = crate::async_runtime::block_on(async {
unsafe { server.async_handle_message(r, w, None, None).await }
});
assert!(result.is_err());
Expand Down
3 changes: 2 additions & 1 deletion src/api/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ use arc_swap::ArcSwap;

use crate::abi::fuse_abi::*;
use crate::api::filesystem::{Context, FileSystem, ZeroCopyReader, ZeroCopyWriter};
use crate::transport::{FileReadWriteVolatile, Reader, Writer};
use crate::file_traits::FileReadWriteVolatile;
use crate::transport::{Reader, Writer};
use crate::{bytes_to_cstr, BitmapSlice, Error, Result};

#[cfg(feature = "async-io")]
Expand Down
Loading