Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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 nexus/db-queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pem.workspace = true
petgraph.workspace = true
predicates.workspace = true
pretty_assertions.workspace = true
proptest.workspace = true
rcgen.workspace = true
regex.workspace = true
rustls.workspace = true
Expand Down
12 changes: 11 additions & 1 deletion nexus/db-queries/src/db/datastore/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,20 @@ impl LocalStorageDisk {
self.model().slot()
}

pub fn required_dataset_overhead(&self) -> external::ByteCount {
fn required_dataset_overhead(&self) -> external::ByteCount {
self.disk_type_local_storage.required_dataset_overhead()
}

/// Size required for the disk's data plus overhead
pub fn required_dataset_size(&self) -> i64 {
// Both values are ByteCounts, so each fits in i64. The overhead is
// roughly 7% of the disk size (see DiskTypeLocalStorage::new), so the
// sum only approaches i64::MAX for disks of several EiB, far beyond
// what any zpool can hold.
self.size().to_bytes() as i64
+ self.required_dataset_overhead().to_bytes() as i64
}

/// Return the full path to the local storage zvol's device
pub fn zvol_path(&self) -> Result<String, Error> {
let Some(allocation) = &self.local_storage_dataset_allocation else {
Expand Down
Loading
Loading