Skip to content

Commit

Permalink
Don't check ROP if the scrub is done (#1093)
Browse files Browse the repository at this point in the history
Don't check the read_only_parent if the scrub is done

---------

Co-authored-by: Alan Hanson <[email protected]>
  • Loading branch information
leftwo and Alan Hanson authored Jan 10, 2024
1 parent 099c201 commit e71b10d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hyper = { version = "0.14", features = [ "full" ] }
hyper-staticfile = "0.9"
indicatif = { version = "0.17.7", features = ["rayon"] }
itertools = "0.12.0"
libc = "0.2.151"
libc = "0.2"
mime_guess = "2.0.4"
nbd = "0.2.3"
nix = { version = "0.26", features = [ "feature", "uio" ] }
Expand Down
14 changes: 13 additions & 1 deletion upstairs/src/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ impl Volume {
sv_vec
}

#[allow(clippy::if_same_then_else)]
pub fn read_only_parent_for_lba_range(
&self,
start: u64,
Expand All @@ -282,7 +283,10 @@ impl Volume {
if let Some(ref read_only_parent) = self.read_only_parent {
// Check if the scrubber has passed this offset
let scrub_point = self.scrub_point.load(Ordering::SeqCst);
if start + length <= scrub_point {
if scrub_point >= read_only_parent.lba_range.end {
// No need to check ROP, the scrub is done.
None
} else if start + length <= scrub_point {
None
} else {
read_only_parent.lba_range_coverage(start, length)
Expand Down Expand Up @@ -3009,6 +3013,14 @@ mod test {
block, size, scrub_point,
);
assert!(r.is_none());
} else if scrub_point >= parent_blocks {
// We have completed the scrub of the ROP, so we
// go directly to the SubVolume
println!(
"scrub_point {} >= size {}, scrub done. No check",
scrub_point, parent_blocks
);
assert!(r.is_none());
} else {
// Our IO is not fully under the scrub point, but we
// know it's still below the
Expand Down

0 comments on commit e71b10d

Please sign in to comment.