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

Make crucible-downstairs not depend on upstairs #1165

Merged
merged 3 commits into from
Feb 20, 2024
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
3 changes: 2 additions & 1 deletion Cargo.lock

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

4 changes: 4 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ uuid.workspace = true
crucible-workspace-hack.workspace = true
dropshot.workspace = true

[dev-dependencies]
proptest.workspace = true
test-strategy.workspace = true

[build-dependencies]
vergen = { version = "8.2", features = ["cargo", "git", "git2", "rustc" ] }
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ mod test {
#[strategy(1 ..= (u64::MAX / #extent_count as u64))]
extent_size: u64,

#[strategy(crucible_common::MIN_SHIFT..=crucible_common::MAX_SHIFT)]
#[strategy(crate::MIN_SHIFT..=crate::MAX_SHIFT)]
block_shift: u32,
}

Expand Down
1 change: 1 addition & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub use region::{
MIN_SHIFT,
};

pub mod impacted_blocks;
pub mod x509;

pub const REPAIR_PORT_OFFSET: u16 = 4000;
Expand Down
1 change: 0 additions & 1 deletion downstairs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ chrono.workspace = true
clap.workspace = true
crucible-common.workspace = true
crucible-protocol.workspace = true
crucible.workspace = true
dropshot.workspace = true
futures-core.workspace = true
futures.workspace = true
Expand Down
13 changes: 10 additions & 3 deletions downstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::time::Duration;

use crucible::*;
use crucible_common::{build_logger, Block, CrucibleError, MAX_BLOCK_SIZE};
use crucible_common::{
build_logger, crucible_bail, impacted_blocks::extent_from_offset,
integrity_hash, mkdir_for_file, Block, CrucibleError, RegionDefinition,
MAX_ACTIVE_COUNT, MAX_BLOCK_SIZE,
};
use crucible_protocol::{
BlockContext, CrucibleDecoder, CrucibleEncoder, JobId, Message,
ReadRequest, ReadResponse, ReconciliationId, SnapshotDetails,
CRUCIBLE_MESSAGE_VERSION,
};
use repair_client::Client;

use anyhow::{bail, Result};
Expand Down Expand Up @@ -396,7 +404,6 @@ pub fn show_work(ds: &mut Downstairs) {
// DTrace probes for the downstairs
#[usdt::provider(provider = "crucible_downstairs")]
pub mod cdt {
use crate::Arg;
fn submit__read__start(_: u64) {}
fn submit__writeunwritten__start(_: u64) {}
fn submit__write__start(_: u64) {}
Expand Down
17 changes: 9 additions & 8 deletions downstairs/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ pub fn config_path<P: AsRef<Path>>(dir: P) -> PathBuf {

#[cfg(test)]
pub(crate) mod test {
use bytes::Bytes;
use std::fs::rename;
use std::path::PathBuf;

Expand Down Expand Up @@ -3501,7 +3502,7 @@ pub(crate) mod test {
// We use the "all 9's data" and checksum.
fn create_generic_write(
eid: u64,
offset: crucible::Block,
offset: crucible_common::Block,
) -> Vec<crucible_protocol::Write> {
let data = BytesMut::from(&[9u8; 512][..]);
let writes: Vec<crucible_protocol::Write> =
Expand Down Expand Up @@ -4087,7 +4088,7 @@ pub(crate) mod test {
let (_dir, mut region, data) = prepare_random_region().await?;

// Call region_read with a single large contiguous range
let requests: Vec<crucible::ReadRequest> = (1..8)
let requests: Vec<crucible_protocol::ReadRequest> = (1..8)
.map(|i| crucible_protocol::ReadRequest {
eid: 0,
offset: Block::new_512(i),
Expand All @@ -4114,7 +4115,7 @@ pub(crate) mod test {

// Call region_read with a single large contiguous range that spans
// multiple extents
let requests: Vec<crucible::ReadRequest> = (9..28)
let requests: Vec<crucible_protocol::ReadRequest> = (9..28)
.map(|i| crucible_protocol::ReadRequest {
eid: i / 10,
offset: Block::new_512(i % 10),
Expand All @@ -4140,25 +4141,25 @@ pub(crate) mod test {
let (_dir, mut region, data) = prepare_random_region().await?;

// Call region_read with a multiple disjoint large contiguous ranges
let requests: Vec<crucible::ReadRequest> = vec![
let requests: Vec<crucible_protocol::ReadRequest> = vec![
(1..4)
.map(|i| crucible_protocol::ReadRequest {
eid: i / 10,
offset: Block::new_512(i % 10),
})
.collect::<Vec<crucible::ReadRequest>>(),
.collect::<Vec<crucible_protocol::ReadRequest>>(),
(15..24)
.map(|i| crucible_protocol::ReadRequest {
eid: i / 10,
offset: Block::new_512(i % 10),
})
.collect::<Vec<crucible::ReadRequest>>(),
.collect::<Vec<crucible_protocol::ReadRequest>>(),
(27..28)
.map(|i| crucible_protocol::ReadRequest {
eid: i / 10,
offset: Block::new_512(i % 10),
})
.collect::<Vec<crucible::ReadRequest>>(),
.collect::<Vec<crucible_protocol::ReadRequest>>(),
]
.into_iter()
.flatten()
Expand Down Expand Up @@ -4188,7 +4189,7 @@ pub(crate) mod test {
let (_dir, mut region, data) = prepare_random_region().await?;

// Call region_read with a multiple disjoint non-contiguous ranges
let requests: Vec<crucible::ReadRequest> = vec![
let requests: Vec<crucible_protocol::ReadRequest> = vec![
crucible_protocol::ReadRequest {
eid: 0,
offset: Block::new_512(0),
Expand Down
3 changes: 1 addition & 2 deletions upstairs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ use guest::{GuestIoHandle, GuestWorkId};

mod stats;

mod impacted_blocks;
pub use impacted_blocks::*;
pub use crucible_common::impacted_blocks::*;

mod deferred;
mod live_repair;
Expand Down
Loading