Skip to content
Open
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
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
14 changes: 14 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 @@ -294,6 +295,7 @@ impl Extent {
def: &RegionDefinition,
number: ExtentId,
read_only: bool,
recordsize: u64,
log: &Logger,
) -> Result<Extent> {
/*
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -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)?,
Expand Down
18 changes: 6 additions & 12 deletions downstairs/src/extent_inner_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ impl ExtentInner for RawInner {
req.offset.0 as i64 * block_size as i64,
)
};

cdt::extent__read__file__done!(|| {
(job_id.0, self.extent_number.0, num_blocks)
});

// Check against the expected number of bytes. We could do more
// robust error handling here (e.g. retrying in a loop), but for
// now, simply bailing out seems wise.
Expand All @@ -380,10 +385,6 @@ impl ExtentInner for RawInner {
buf.set_len(expected_bytes);
}

cdt::extent__read__file__done!(|| {
(job_id.0, self.extent_number.0, num_blocks)
});

Ok(ExtentReadResponse { data: buf, blocks })
}

Expand Down Expand Up @@ -1104,18 +1105,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 }
Expand Down
Loading