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

Raw extent v2 #1270

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
@@ -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" ] }
1 change: 1 addition & 0 deletions downstairs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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]
14 changes: 14 additions & 0 deletions downstairs/src/extent.rs
Original file line number Diff line number Diff line change
@@ -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 {
@@ -294,6 +295,7 @@ impl Extent {
def: &RegionDefinition,
number: ExtentId,
read_only: bool,
recordsize: u64,
log: &Logger,
) -> Result<Extent> {
/*
@@ -445,6 +447,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, recordsize, log,
)?)
}
i => {
return Err(CrucibleError::IoError(format!(
"raw extent {number} has unknown tag {i}"
@@ -489,6 +496,7 @@ impl Extent {
def: &RegionDefinition,
number: ExtentId,
backend: Backend,
recordsize: u64,
) -> Result<Extent> {
/*
* Store extent data in files within a directory hierarchy so that
@@ -507,9 +515,15 @@ 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, recordsize,
)?)
}
#[cfg(any(test, feature = "integration-tests"))]
Backend::SQLite => Box::new(
extent_inner_sqlite::SqliteInner::create(dir, def, number)?,
9 changes: 1 addition & 8 deletions downstairs/src/extent_inner_raw.rs
Original file line number Diff line number Diff line change
@@ -1104,18 +1104,11 @@ impl RawInner {
}

/// Data structure that implements the on-disk layout of a raw extent file
#[derive(Debug)]
struct RawLayout {
extent_size: Block,
}

impl std::fmt::Debug for RawLayout {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RawLayout")
.field("extent_size", &self.extent_size)
.finish()
}
}

impl RawLayout {
fn new(extent_size: Block) -> Self {
RawLayout { extent_size }
Loading