@@ -307,6 +307,7 @@
Loading
307 307
        if let Some(id) = last_id {
308 308
            self.journal.finished_to_clean(&[id])?;
309 309
        }
310 +
        allocator.trim_free_at_end()?;
310 311
        Ok(())
311 312
    }
312 313

@@ -35,6 +35,8 @@
Loading
35 35
    fn sync(&self) -> PRes<()>;
36 36
37 37
    fn trim_or_free_page(&self, page: u64, update_list: &mut dyn UpdateList) -> PRes<()>;
38 +
39 +
    fn trim_end_pages(&self, update_list: &mut dyn UpdateList) -> PRes<()>;
38 40
}
39 41
40 42
trait SizeTool {
@@ -564,10 +566,15 @@
Loading
564 566
                self.file.write_all_at(&[0u8; 16], page + 10)?;
565 567
            }
566 568
        } else {
567 -
            while self.check_and_trim(update_list)? {}
569 +
            self.trim_end_pages(update_list)?;
568 570
        }
569 571
        Ok(())
570 572
    }
573 +
574 +
    fn trim_end_pages(&self, update_list: &mut dyn UpdateList) -> PRes<()> {
575 +
        while self.check_and_trim(update_list)? {}
576 +
        Ok(())
577 +
    }
571 578
}
572 579
573 580
#[cfg(not(unix))]
@@ -643,6 +650,11 @@
Loading
643 650
    fn trim_or_free_page(&self, page: u64, update_list: &mut dyn UpdateList) -> PRes<()> {
644 651
        trim_or_free_page(&mut self.file.lock()?.file, page, update_list)
645 652
    }
653 +
654 +
    fn trim_end_pages(&self, update_list: &mut dyn UpdateList) -> PRes<()> {
655 +
        while check_and_trim(&mut self.file.lock()?.file, update_list)? {}
656 +
        Ok(())
657 +
    }
646 658
}
647 659
648 660
pub struct MemRef {
@@ -688,6 +700,10 @@
Loading
688 700
    fn trim_or_free_page(&self, page: u64, update_list: &mut dyn UpdateList) -> PRes<()> {
689 701
        trim_or_free_page(&mut *self.data.lock()?, page, update_list)
690 702
    }
703 +
    fn trim_end_pages(&self, update_list: &mut dyn UpdateList) -> PRes<()> {
704 +
        while check_and_trim(&mut *self.data.lock()?, update_list)? {}
705 +
        Ok(())
706 +
    }
691 707
}
692 708
#[cfg(test)]
693 709
mod tests {

@@ -239,6 +239,11 @@
Loading
239 239
        }
240 240
        Ok(())
241 241
    }
242 +
    pub fn trim_free_at_end(&self) -> PRes<()> {
243 +
        let mut fl = self.free_list.lock()?;
244 +
        self.disc.trim_end_pages(&mut fl.list)?;
245 +
        Ok(())
246 +
    }
242 247
243 248
    pub fn free(&self, page: u64) -> PRes<()> {
244 249
        self.cache.lock()?.remove(page);
Files Coverage
src 92.75%
tests 98.56%
Project Totals (29 files) 93.79%
1
coverage:
2
  status:
3
    project:
4
      default:
5
        target: 80%
6
        threshold: 1.0%
7
    patch: off
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading