From 7ab97a9aae485bfa82fdc3544937cb1731cd7a9c Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Sat, 12 Jun 2021 21:14:19 +0800 Subject: [PATCH] [space_map (rust)] Fix nr_free in index entries --- src/pdata/space_map_metadata.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pdata/space_map_metadata.rs b/src/pdata/space_map_metadata.rs index e7c22fd..4e2e563 100644 --- a/src/pdata/space_map_metadata.rs +++ b/src/pdata/space_map_metadata.rs @@ -70,7 +70,7 @@ fn adjust_counts(w: &mut WriteBatcher, ie: &IndexEntry, allocs: &[u64]) -> Resul use BitmapEntry::*; 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 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; } - if bitmap.entries[*a as usize] == Small(0) { - nr_free -= 1; - } - bitmap.entries[*a as usize] = Small(1); }