Skip to content

Commit

Permalink
Still more updates to support Volume layer activities. (#1508)
Browse files Browse the repository at this point in the history
Two new structs to describe a Volume:

pub struct VolumeInfo {
    pub block_size: u64,
    pub volumes: Vec<SubVolumeInfo>,
}
pub struct SubVolumeInfo {
    pub blocks_per_extent: u64,
    pub extent_count: u32,
}

Added a new method to the `Volume` type that will gather extent info
from each sub-volume and return a `VolumeInfo` struct that describes the
whole volume.

In the `BlockIO` trait, replaced `query_extent_size` with
`query_extent_info`. Objects that support this call will return the
`RegionExtentInfo` type filled out. Things that do not will just return
`None`.

Updated crutest's `RegionInfo` struct to have a `VolumeInfo` field.

Updated the fill_sparse and span crutest tests to perform their work on
all sub-volumes.

print_region_description looks like this:
----------------------------------------------
random read with 4 KiB chunks (1 block)
region info:
  block size:                   4096 bytes
  sub_volume 0 blocks / extent: 100
  sub_volume 0 extent count:    15
  sub_volume 0 extent size:     400 KiB
  sub_volume 1 blocks / extent: 100
  sub_volume 1 extent count:    15
  sub_volume 1 extent size:     400 KiB
  total blocks:                 3000
  total size:                   11.7 MiB
  encryption:                   no
----------------------------------------------

Added fill-sparse test to crutest cli

Coming in a follow up PR I would like to rename `RegionInfo` in crutest
to be `DiskInfo`. This would just be name changes, no functional
changes. I decided to break that out to reduce review overhead.

---------

Co-authored-by: Alan Hanson <alan@oxide.computer>
  • Loading branch information
leftwo and Alan Hanson authored Oct 31, 2024
1 parent 6e29eb6 commit 540fd3a
Show file tree
Hide file tree
Showing 10 changed files with 531 additions and 339 deletions.
4 changes: 4 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ pub enum CrucibleError {
#[error("Subvolume size mismatch!")]
SubvolumeSizeMismatch,

#[error("Subvolume type mismatch!")]
SubvolumeTypeMismatch,

#[error("Cannot serve blocks: {0}")]
CannotServeBlocks(String),

Expand Down Expand Up @@ -407,6 +410,7 @@ impl From<CrucibleError> for dropshot::HttpError {
| CrucibleError::RwLockError(_)
| CrucibleError::SendError(_)
| CrucibleError::SubvolumeSizeMismatch
| CrucibleError::SubvolumeTypeMismatch
| CrucibleError::UpstairsActivateInProgress
| CrucibleError::UpstairsDeactivating
| CrucibleError::UuidMismatch
Expand Down
Loading

0 comments on commit 540fd3a

Please sign in to comment.