File tree 1 file changed +7
-0
lines changed
src/util/metadata/side_metadata
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1066,6 +1066,8 @@ impl SideMetadataSpec {
1066
1066
let end_addr = data_addr;
1067
1067
1068
1068
// Then figure out the start and end metadata address and bits.
1069
+ // The start bit may not be accurate, as we map any address in the region to the same bit.
1070
+ // We will filter the result at the end to make sure the found address is in the search range.
1069
1071
let start_meta_addr = address_to_contiguous_meta_address ( self , start_addr) ;
1070
1072
let start_meta_shift = meta_byte_lshift ( self , start_addr) ;
1071
1073
let end_meta_addr = address_to_contiguous_meta_address ( self , end_addr) ;
@@ -1120,7 +1122,12 @@ impl SideMetadataSpec {
1120
1122
& mut visitor,
1121
1123
) ;
1122
1124
1125
+ // We have to filter the result. We search between [start_addr, end_addr). But we actually
1126
+ // search with metadata bits. It is possible the metadata bit for start_addr is the same bit
1127
+ // as an address that is before start_addr. E.g. 0x2010f026360 and 0x2010f026361 are mapped
1128
+ // to the same bit, 0x2010f026361 is the start address and 0x2010f026360 is outside the search range.
1123
1129
res. map ( |addr| addr. align_down ( 1 << self . log_bytes_in_region ) )
1130
+ . filter ( |addr| * addr >= start_addr && * addr < end_addr)
1124
1131
}
1125
1132
1126
1133
/// Search for data addresses that have non zero values in the side metadata. This method is
You can’t perform that action at this time.
0 commit comments