@@ -583,6 +583,20 @@ impl ExtentInner for RawInner {
583583
584584 fn validate ( & self ) -> Result < ( ) , CrucibleError > {
585585 let block_size = self . extent_size . block_size_in_bytes ( ) as u64 ;
586+
587+ let ctx_a = self . layout . read_context_slots_contiguous (
588+ & self . file ,
589+ 0 ,
590+ self . layout . block_count ( ) ,
591+ ContextSlot :: A ,
592+ ) ?;
593+ let ctx_b = self . layout . read_context_slots_contiguous (
594+ & self . file ,
595+ 0 ,
596+ self . layout . block_count ( ) ,
597+ ContextSlot :: B ,
598+ ) ?;
599+
586600 for block in 0 ..self . extent_size . value {
587601 // Read the block data itself:
588602 let mut buf = vec ! [ 0 ; block_size as usize ] ;
@@ -596,12 +610,10 @@ impl ExtentInner for RawInner {
596610 let hash = integrity_hash ( & [ & buf] ) ;
597611
598612 // Read the active context slot, which is by definition contiguous
599- let slot = self . active_context [ block] ;
600- let mut context = self
601- . layout
602- . read_context_slots_contiguous ( & self . file , block, 1 , slot) ?;
603- assert_eq ! ( context. len( ) , 1 ) ;
604- let context = context. pop ( ) . unwrap ( ) ;
613+ let context = match self . active_context [ block] {
614+ ContextSlot :: A => & ctx_a,
615+ ContextSlot :: B => & ctx_b,
616+ } [ block as usize ] ;
605617
606618 if let Some ( context) = context {
607619 if context. on_disk_hash == hash {
0 commit comments