Skip to content

Commit

Permalink
Port and simplify raw-file-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Aug 2, 2024
1 parent 07cb9ed commit 0f03bf1
Show file tree
Hide file tree
Showing 8 changed files with 1,100 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ tracing-subscriber = "0.3.18"
twox-hash = "1.6.3"
usdt = "0.5.0"
uuid = { version = "1", features = [ "serde", "v4" ] }
zerocopy = "0.7.32"

# git
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
Expand Down
1 change: 1 addition & 0 deletions downstairs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tracing-subscriber.workspace = true
tracing.workspace = true
usdt.workspace = true
uuid.workspace = true
zerocopy.workspace = true
crucible-workspace-hack.workspace = true

[dev-dependencies]
Expand Down
10 changes: 10 additions & 0 deletions downstairs/src/extent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub const EXTENT_META_SQLITE: u32 = 1;
///
/// See [`extent_inner_raw::RawInner`] for the implementation.
pub const EXTENT_META_RAW: u32 = 2;
pub const EXTENT_META_RAW_V2: u32 = 3;

impl ExtentMeta {
pub fn new(ext_version: u32) -> ExtentMeta {
Expand Down Expand Up @@ -445,6 +446,11 @@ impl Extent {
dir, def, number, read_only, log,
)?)
}
EXTENT_META_RAW_V2 => {
Box::new(extent_inner_raw_v2::RawInnerV2::open(
dir, def, number, read_only, log,
)?)
}
i => {
return Err(CrucibleError::IoError(format!(
"raw extent {number} has unknown tag {i}"
Expand Down Expand Up @@ -507,9 +513,13 @@ impl Extent {
remove_copy_cleanup_dir(dir, number)?;

let inner: Box<dyn ExtentInner + Send + Sync> = match backend {
#[cfg(any(test, feature = "integration-tests"))]
Backend::RawFile => {
Box::new(extent_inner_raw::RawInner::create(dir, def, number)?)
}
Backend::RawFileV2 => Box::new(
extent_inner_raw_v2::RawInnerV2::create(dir, def, number)?,
),
#[cfg(any(test, feature = "integration-tests"))]
Backend::SQLite => Box::new(
extent_inner_sqlite::SqliteInner::create(dir, def, number)?,
Expand Down
Loading

0 comments on commit 0f03bf1

Please sign in to comment.