@@ -1352,26 +1352,6 @@ impl Upstairs {
1352
1352
cdt:: up__to__ds__read__start!( || ( gw_id. 0 ) ) ;
1353
1353
}
1354
1354
1355
- /// Submits a new write job to the upstairs
1356
- ///
1357
- /// This function **defers** the write job submission, because writes
1358
- /// require encrypting data (which is expensive) and we'd like to return as
1359
- /// quickly as possible.
1360
- fn submit_deferred_write (
1361
- & mut self ,
1362
- offset : BlockIndex ,
1363
- data : BytesMut ,
1364
- res : BlockRes ,
1365
- is_write_unwritten : bool ,
1366
- ) {
1367
- self . submit_deferred_write_inner (
1368
- offset,
1369
- data,
1370
- Some ( res) ,
1371
- is_write_unwritten,
1372
- )
1373
- }
1374
-
1375
1355
/// Submits a dummy write (without an associated `BlockOp`)
1376
1356
///
1377
1357
/// This **does not** go through the deferred-write pipeline
@@ -1382,22 +1362,26 @@ impl Upstairs {
1382
1362
data : BytesMut ,
1383
1363
is_write_unwritten : bool ,
1384
1364
) {
1385
- if let Some ( w) =
1386
- self . compute_deferred_write ( offset, data, None , is_write_unwritten)
1387
- {
1365
+ if let Some ( w) = self . compute_deferred_write (
1366
+ offset,
1367
+ data,
1368
+ BlockRes :: dummy ( ) ,
1369
+ is_write_unwritten,
1370
+ ) {
1388
1371
self . submit_write ( DeferredWrite :: run ( w) )
1389
1372
}
1390
1373
}
1391
1374
1392
- /// Submits a new write job to the upstairs, optionally without a `BlockRes`
1375
+ /// Submits a new write job to the upstairs
1393
1376
///
1394
- /// # Panics
1395
- /// If `res` is `None` and this isn't running in the test suite
1396
- fn submit_deferred_write_inner (
1377
+ /// This function **defers** the write job submission, because writes
1378
+ /// require encrypting data (which is expensive) and we'd like to return as
1379
+ /// quickly as possible.
1380
+ fn submit_deferred_write (
1397
1381
& mut self ,
1398
1382
offset : BlockIndex ,
1399
1383
data : BytesMut ,
1400
- res : Option < BlockRes > ,
1384
+ res : BlockRes ,
1401
1385
is_write_unwritten : bool ,
1402
1386
) {
1403
1387
// It's possible for the write to be invalid out of the gate, in which
@@ -1426,22 +1410,15 @@ impl Upstairs {
1426
1410
& mut self ,
1427
1411
offset : BlockIndex ,
1428
1412
data : BytesMut ,
1429
- res : Option < BlockRes > ,
1413
+ res : BlockRes ,
1430
1414
is_write_unwritten : bool ,
1431
1415
) -> Option < DeferredWrite > {
1432
- #[ cfg( not( test) ) ]
1433
- assert ! ( res. is_some( ) ) ;
1434
-
1435
1416
if !self . guest_io_ready ( ) {
1436
- if let Some ( res) = res {
1437
- res. send_err ( CrucibleError :: UpstairsInactive ) ;
1438
- }
1417
+ res. send_err ( CrucibleError :: UpstairsInactive ) ;
1439
1418
return None ;
1440
1419
}
1441
1420
if self . cfg . read_only {
1442
- if let Some ( res) = res {
1443
- res. send_err ( CrucibleError :: ModifyingReadOnlyRegion ) ;
1444
- }
1421
+ res. send_err ( CrucibleError :: ModifyingReadOnlyRegion ) ;
1445
1422
return None ;
1446
1423
}
1447
1424
@@ -1450,9 +1427,7 @@ impl Upstairs {
1450
1427
*/
1451
1428
let ddef = self . ddef . get_def ( ) . unwrap ( ) ;
1452
1429
if let Err ( e) = ddef. validate_io ( offset, data. len ( ) ) {
1453
- if let Some ( res) = res {
1454
- res. send_err ( e) ;
1455
- }
1430
+ res. send_err ( e) ;
1456
1431
return None ;
1457
1432
}
1458
1433
@@ -1500,7 +1475,7 @@ impl Upstairs {
1500
1475
write. is_write_unwritten ,
1501
1476
)
1502
1477
} ,
1503
- write . res . map ( GuestBlockRes :: Other ) ,
1478
+ Some ( GuestBlockRes :: Other ( write . res ) ) ,
1504
1479
) ;
1505
1480
1506
1481
if write. is_write_unwritten {
0 commit comments