Skip to content

Commit 8d7144a

Browse files
wllenyjjiangliu
authored andcommitted
remove temporarily tokio-uring
The pendding PRs has been merged, We should use `crate.io` directly instead of this temporary copy. tokio-rs/tokio-uring#87 tokio-rs/tokio-uring#88 Signed-off-by: wanglei01 <[email protected]>
1 parent ffc5b24 commit 8d7144a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+16
-3745
lines changed

Cargo.toml

+3-6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mio = { version = "0.8", features = ["os-poll", "os-ext"]}
2626
nix = "0.24"
2727
lazy_static = "1.4"
2828
tokio = { version = "1", optional = true }
29+
tokio-uring = { version = "0.4.0", optional = true }
2930
vmm-sys-util = { version = "0.10", optional = true }
3031
vm-memory = { version = "0.9", features = ["backend-mmap"] }
3132
virtio-queue = { version = "0.4", optional = true }
@@ -36,11 +37,7 @@ core-foundation-sys = { version = ">=0.8", optional = true }
3637

3738
[target.'cfg(target_os = "linux")'.dependencies]
3839
caps = { version = "0.5", optional = true }
39-
tokio-uring = "0.3"
40-
io-uring = { version = "0.5", features = ["unstable"] }
41-
socket2 = { version = "0.4.4", features = ["all"] }
42-
scoped-tls = "1.0.0"
43-
slab = "0.4.6"
40+
tokio-uring = "0.4"
4441

4542
[dev-dependencies]
4643
tokio-test = "0.4.2"
@@ -49,7 +46,7 @@ vm-memory = { version = "0.9", features = ["backend-mmap", "backend-bitmap"] }
4946

5047
[features]
5148
default = ["fusedev"]
52-
async-io = ["async-trait", "tokio/fs", "tokio/net", "tokio/sync", "tokio/rt", "tokio/macros"]
49+
async-io = ["async-trait", "tokio-uring", "tokio/fs", "tokio/net", "tokio/sync", "tokio/rt", "tokio/macros"]
5350
fusedev = ["vmm-sys-util", "caps", "core-foundation-sys"]
5451
virtiofs = ["virtio-queue", "caps"]
5552
vhost-user-fs = ["virtiofs", "vhost", "caps"]

README.md

-7
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,3 @@ impl FuseServer {
9393
This project is licensed under
9494
- [Apache License](http://www.apache.org/licenses/LICENSE-2.0), Version 2.0
9595
- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
96-
97-
Source code under [src/tokio-uring] is temporarily copied from [tokio-uring](https://github.com/tokio-rs/tokio-uring)
98-
with modifications, which is licensed under [MIT](https://github.com/tokio-rs/tokio-uring/blob/master/LICENSE).
99-
100-
We will use `crate.io` directly instead of this temporary copy when the pendding PRs is merged.
101-
https://github.com/tokio-rs/tokio-uring/pull/87
102-
https://github.com/tokio-rs/tokio-uring/pull/88

src/common/async_file.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl File {
4444
.await
4545
.map(File::Tokio),
4646
#[cfg(target_os = "linux")]
47-
2 => crate::tokio_uring::fs::OpenOptions::new()
47+
2 => tokio_uring::fs::OpenOptions::new()
4848
.read(true)
4949
.write(write)
5050
.create(create)
@@ -79,7 +79,7 @@ impl File {
7979
// Safety: we rely on tokio_uring::fs::File internal implementation details.
8080
// It should be implemented as self.async_try_clone().await.unwrap().read_at,
8181
// but that causes two more syscalls.
82-
let file = unsafe { crate::tokio_uring::fs::File::from_raw_fd(*fd) };
82+
let file = unsafe { tokio_uring::fs::File::from_raw_fd(*fd) };
8383
let res = file.read_at(buf, offset).await;
8484
std::mem::forget(file);
8585
res
@@ -105,7 +105,7 @@ impl File {
105105
// Safety: we rely on tokio_uring::fs::File internal implementation details.
106106
// It should be implemented as self.async_try_clone().await.unwrap().readv_at,
107107
// but that causes two more syscalls.
108-
let file = unsafe { crate::tokio_uring::fs::File::from_raw_fd(*fd) };
108+
let file = unsafe { tokio_uring::fs::File::from_raw_fd(*fd) };
109109
let res = file.readv_at(bufs, offset).await;
110110
std::mem::forget(file);
111111
res
@@ -132,7 +132,7 @@ impl File {
132132
// Safety: we rely on tokio_uring::fs::File internal implementation details.
133133
// It should be implemented as self.async_try_clone().await.unwrap().write_at,
134134
// but that causes two more syscalls.
135-
let file = unsafe { crate::tokio_uring::fs::File::from_raw_fd(*fd) };
135+
let file = unsafe { tokio_uring::fs::File::from_raw_fd(*fd) };
136136
let res = file.write_at(buf, offset).await;
137137
std::mem::forget(file);
138138
res
@@ -158,7 +158,7 @@ impl File {
158158
// Safety: we rely on tokio_uring::fs::File internal implementation details.
159159
// It should be implemented as self.async_try_clone().await.unwrap().writev_at,
160160
// but that causes two more syscalls.
161-
let file = unsafe { crate::tokio_uring::fs::File::from_raw_fd(*fd) };
161+
let file = unsafe { tokio_uring::fs::File::from_raw_fd(*fd) };
162162
let res = file.writev_at(bufs, offset).await;
163163
std::mem::forget(file);
164164
res
@@ -214,7 +214,7 @@ impl Drop for File {
214214
fn drop(&mut self) {
215215
#[cfg(target_os = "linux")]
216216
if let File::Uring(fd) = self {
217-
let _ = unsafe { crate::tokio_uring::fs::File::from_raw_fd(*fd) };
217+
let _ = unsafe { tokio_uring::fs::File::from_raw_fd(*fd) };
218218
}
219219
}
220220
}

src/common/async_runtime.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub enum Runtime {
1212
Tokio(tokio::runtime::Runtime),
1313
#[cfg(target_os = "linux")]
1414
/// Tokio-uring Runtime.
15-
Uring(std::sync::Mutex<crate::tokio_uring::Runtime>),
15+
Uring(std::sync::Mutex<tokio_uring::Runtime>),
1616
}
1717

1818
impl Runtime {
@@ -28,7 +28,7 @@ impl Runtime {
2828
#[cfg(target_os = "linux")]
2929
{
3030
// TODO: use io-uring probe to detect supported operations.
31-
if let Ok(rt) = crate::tokio_uring::Runtime::new() {
31+
if let Ok(rt) = tokio_uring::Runtime::new(&tokio_uring::builder()) {
3232
return Runtime::Uring(std::sync::Mutex::new(rt));
3333
}
3434
}
@@ -93,7 +93,7 @@ pub fn spawn<T: std::future::Future + 'static>(task: T) -> tokio::task::JoinHand
9393
CURRENT_RUNTIME.with(|rt| match rt {
9494
Runtime::Tokio(_) => tokio::task::spawn_local(task),
9595
#[cfg(target_os = "linux")]
96-
Runtime::Uring(_) => crate::tokio_uring::spawn(task),
96+
Runtime::Uring(_) => tokio_uring::spawn(task),
9797
})
9898
}
9999

src/common/file_buf.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,11 @@ impl FileVolatileBuf {
354354
}
355355
}
356356

357-
#[cfg(all(feature = "async-io", target_os = "linux"))]
358-
pub use crate::tokio_uring::buf::{IoBuf, IoBufMut, Slice};
359-
360357
#[cfg(all(feature = "async-io", target_os = "linux"))]
361358
mod async_io {
362359
use super::*;
363360

364-
unsafe impl crate::tokio_uring::buf::IoBuf for FileVolatileBuf {
361+
unsafe impl tokio_uring::buf::IoBuf for FileVolatileBuf {
365362
fn stable_ptr(&self) -> *const u8 {
366363
self.addr as *const u8
367364
}
@@ -375,7 +372,7 @@ mod async_io {
375372
}
376373
}
377374

378-
unsafe impl crate::tokio_uring::buf::IoBufMut for FileVolatileBuf {
375+
unsafe impl tokio_uring::buf::IoBufMut for FileVolatileBuf {
379376
fn stable_mut_ptr(&mut self) -> *mut u8 {
380377
self.addr as *mut u8
381378
}
@@ -388,7 +385,7 @@ mod async_io {
388385
#[cfg(test)]
389386
mod tests {
390387
use super::*;
391-
use crate::tokio_uring::buf::{IoBuf, IoBufMut};
388+
use tokio_uring::buf::{IoBuf, IoBufMut};
392389

393390
#[test]
394391
fn test_new_file_volatile_buf() {

src/common/file_traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,11 @@ mod async_io {
455455
use std::sync::Arc;
456456

457457
use tokio::join;
458+
use tokio_uring::buf::IoBuf;
458459

459460
use super::*;
460461
use crate::async_file::File;
461462
use crate::file_buf::FileVolatileBuf;
462-
use crate::tokio_uring::buf::IoBuf;
463463

464464
/// Extension of [FileReadWriteVolatile] to support io-uring based asynchronous IO.
465465
///

src/common/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ pub mod async_runtime;
2424
#[cfg(feature = "async-io")]
2525
pub mod mpmc;
2626

27-
// Temporarily include all source code tokio-uring.
28-
// Will switch to upstream once our enhancement have been merged and new version available.
29-
#[cfg(all(feature = "async-io", target_os = "linux"))]
30-
pub mod tokio_uring;
31-
#[cfg(all(feature = "async-io", target_os = "linux"))]
32-
pub(crate) use self::tokio_uring::{buf, driver, fs, future, BufResult};
33-
3427
#[cfg(target_os = "linux")]
3528
#[doc(hidden)]
3629
pub use libc::{off64_t, pread64, preadv64, pwrite64, pwritev64};

src/common/tokio_uring/buf/io_buf.rs

-162
This file was deleted.

0 commit comments

Comments
 (0)