Skip to content

Commit e71b10d

Browse files
leftwoAlan Hanson
and
Alan Hanson
authored
Don't check ROP if the scrub is done (#1093)
Don't check the read_only_parent if the scrub is done --------- Co-authored-by: Alan Hanson <alan@oxide.computer>
1 parent 099c201 commit e71b10d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ hyper = { version = "0.14", features = [ "full" ] }
5555
hyper-staticfile = "0.9"
5656
indicatif = { version = "0.17.7", features = ["rayon"] }
5757
itertools = "0.12.0"
58-
libc = "0.2.151"
58+
libc = "0.2"
5959
mime_guess = "2.0.4"
6060
nbd = "0.2.3"
6161
nix = { version = "0.26", features = [ "feature", "uio" ] }

upstairs/src/volume.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ impl Volume {
274274
sv_vec
275275
}
276276

277+
#[allow(clippy::if_same_then_else)]
277278
pub fn read_only_parent_for_lba_range(
278279
&self,
279280
start: u64,
@@ -282,7 +283,10 @@ impl Volume {
282283
if let Some(ref read_only_parent) = self.read_only_parent {
283284
// Check if the scrubber has passed this offset
284285
let scrub_point = self.scrub_point.load(Ordering::SeqCst);
285-
if start + length <= scrub_point {
286+
if scrub_point >= read_only_parent.lba_range.end {
287+
// No need to check ROP, the scrub is done.
288+
None
289+
} else if start + length <= scrub_point {
286290
None
287291
} else {
288292
read_only_parent.lba_range_coverage(start, length)
@@ -3009,6 +3013,14 @@ mod test {
30093013
block, size, scrub_point,
30103014
);
30113015
assert!(r.is_none());
3016+
} else if scrub_point >= parent_blocks {
3017+
// We have completed the scrub of the ROP, so we
3018+
// go directly to the SubVolume
3019+
println!(
3020+
"scrub_point {} >= size {}, scrub done. No check",
3021+
scrub_point, parent_blocks
3022+
);
3023+
assert!(r.is_none());
30123024
} else {
30133025
// Our IO is not fully under the scrub point, but we
30143026
// know it's still below the

0 commit comments

Comments
 (0)