open_failed = true;
return true; // Keep walking to try other overlapping fallbacks
}
+ // BeesExtentSlice::refs() walks forward from the slice
+ // start but may skip regions with no ref, so the first
+ // leaf can begin AFTER the cursor. The mapping below is
+ // only valid when the leaf covers the cursor: with a gap,
+ // "cursor - src_ref.begin()" is an unsigned subtraction
+ // that wraps, and src_file_begin silently lands that many
+ // bytes before the ref's real start. The pair is then
+ // built against data the matcher never looked at, and the
+ // kernel rejects it as "NO Dedup!".
+ //
+ // There is no src ref for [cursor, src_ref.begin()), so
+ // this plan cannot be executed as planned. Leave covered
+ // false and let the caller abandon it, exactly as it does
+ // when a ref has vanished.
+ if (src_ref.begin() > cursor) {
+ BEESCOUNT(plan_src_gap);
+ return false;
+ }
const auto overlap_end = min(src_ref.end(), dst_ref.end());
const auto src_file_begin = src_ref.file_begin() + cursor - src_ref.begin();
const auto src_file_end = src_file_begin + overlap_end - cursor;