[space_map (rust)] Fix nr_free in index entries

This commit is contained in:
Ming-Hung Tsai 2021-06-12 21:14:19 +08:00
parent 4b7b3658ff
commit 7ab97a9aae

View File

@ -70,7 +70,7 @@ fn adjust_counts(w: &mut WriteBatcher, ie: &IndexEntry, allocs: &[u64]) -> Resul
use BitmapEntry::*; use BitmapEntry::*;
let mut first_free = ie.none_free_before; let mut first_free = ie.none_free_before;
let mut nr_free = ie.nr_free - allocs.len() as u32; let nr_free = ie.nr_free - allocs.len() as u32;
// Read the bitmap // Read the bitmap
let bitmap_block = w.engine.read(ie.blocknr)?; let bitmap_block = w.engine.read(ie.blocknr)?;
@ -82,10 +82,6 @@ fn adjust_counts(w: &mut WriteBatcher, ie: &IndexEntry, allocs: &[u64]) -> Resul
first_free = *a as u32 + 1; first_free = *a as u32 + 1;
} }
if bitmap.entries[*a as usize] == Small(0) {
nr_free -= 1;
}
bitmap.entries[*a as usize] = Small(1); bitmap.entries[*a as usize] = Small(1);
} }