@@ -617,17 +617,25 @@ static void extract_base_fs_allocations(const char *directory, const char *mount
617
617
} else {
618
618
end_block = parse_num (range );
619
619
}
620
- block_file_size = end_block - start_block + 1 ;
621
- if (block_file_size > real_file_block_size ) {
622
- block_file_size = real_file_block_size ;
623
- }
624
620
// Assummption is that allocations are within the same block group
625
621
block_group = get_block_group (start_block );
626
622
if (block_group != get_block_group (end_block )) {
627
623
critical_error ("base file allocation's end block is in a different "
628
624
"block group than start block. did you change fs params?" );
629
625
}
630
626
block_range = strtok_r (NULL , "," , & end_string );
627
+ int bg_first_block = bgs [block_group ].first_block ;
628
+ int min_bg_bound = bgs [block_group ].chunks [0 ].block + bgs [block_group ].chunks [0 ].len ;
629
+ int max_bg_bound = bgs [block_group ].chunks [bgs [block_group ].chunk_count - 1 ].block ;
630
+
631
+ if (min_bg_bound >= start_block - bg_first_block ||
632
+ max_bg_bound <= end_block - bg_first_block ) {
633
+ continue ;
634
+ }
635
+ block_file_size = end_block - start_block + 1 ;
636
+ if (block_file_size > real_file_block_size ) {
637
+ block_file_size = real_file_block_size ;
638
+ }
631
639
append_region (fs_alloc , start_block , block_file_size , block_group );
632
640
reserve_bg_chunk (block_group , start_block - bgs [block_group ].first_block , block_file_size );
633
641
real_file_block_size -= block_file_size ;
0 commit comments