@@ -2707,17 +2707,7 @@ impl Downstairs {
2707
2707
}
2708
2708
// Now that we've collected jobs to retire, remove them from the map
2709
2709
for & id in & retired {
2710
- let job = self . ds_active . remove ( & id) ;
2711
- // Update pending bytes when this job is retired
2712
- let change = match & job. work {
2713
- IOop :: Write { data, .. }
2714
- | IOop :: WriteUnwritten { data, .. } => {
2715
- data. io_size_bytes as u64
2716
- }
2717
- _ => 0 ,
2718
- } ;
2719
- self . write_bytes_outstanding =
2720
- self . write_bytes_outstanding . checked_sub ( change) . unwrap ( ) ;
2710
+ let _ = self . ds_active . remove ( & id) ;
2721
2711
}
2722
2712
2723
2713
debug ! ( self . log, "[rc] retire {} clears {:?}" , ds_id, retired) ;
@@ -3205,6 +3195,24 @@ impl Downstairs {
3205
3195
self . ackable_work . insert ( ds_id) ;
3206
3196
}
3207
3197
3198
+ // Write bytes no longer count for backpressure once all 3x downstairs
3199
+ // have returned (although they'll continue to be stored until they are
3200
+ // retired by the next flush).
3201
+ let wc = job. state_count ( ) ;
3202
+ if ( wc. error + wc. skipped + wc. done ) == 3 {
3203
+ match & job. work {
3204
+ IOop :: Write { data, .. }
3205
+ | IOop :: WriteUnwritten { data, .. } => {
3206
+ let change = data. io_size_bytes as u64 ;
3207
+ self . write_bytes_outstanding = self
3208
+ . write_bytes_outstanding
3209
+ . checked_sub ( change)
3210
+ . unwrap ( ) ;
3211
+ }
3212
+ _ => ( ) ,
3213
+ } ;
3214
+ }
3215
+
3208
3216
/*
3209
3217
* If all 3 jobs are done, we can check here to see if we can
3210
3218
* remove this job from the DS list. If we have completed the ack
@@ -3218,7 +3226,6 @@ impl Downstairs {
3218
3226
// hasn't acked back yet. We check for NotAcked so we don't
3219
3227
// double count three done and return true if we already have
3220
3228
// AckReady set.
3221
- let wc = job. state_count ( ) ;
3222
3229
3223
3230
// If we are a write or a flush with one success, then
3224
3231
// we must switch our state to failed. This condition is
0 commit comments