ref: e152be43422edea88c9250da2e2e1afcaaa9e8f7
parent: 364a6d7d4049534089ea1dbfadaaa145ed72798c
author: Ori Bernstein <[email protected]>
date: Sun Apr 30 12:50:29 EDT 2023
blk: only sync arenas when syncing disk we don't want them on disk if things are still in the process of getting written out.
--- a/blk.c
+++ b/blk.c
@@ -194,14 +194,6 @@
}
static int
-syncarena(Arena *a)
-{
- packarena(a->b->data, Blksz, a, fs);
- finalize(a->b);
- return syncblk(a->b);
-}
-
-static int
grabrange(Avltree *t, vlong off, vlong len)
{
Arange *r, *s, q;
@@ -410,7 +402,7 @@
compresslog(Arena *a)
{
vlong v, ba, na, nl, sz, graft, oldhd, *log;
- int i, n, nr, rv;
+ int i, n, nr;
Blk *b, *hd, *tl;
Range *rng;
Arange *r;
@@ -529,10 +521,7 @@
a->loghd.addr = hd->bp.addr;
a->loghd.hash = hd->bp.hash;
a->loghd.gen = -1;
- rv = syncarena(a);
unlock(a);
- if(rv == -1)
- return -1;
if(oldhd != -1){
for(ba = oldhd; ba != -1 && ba != graft; ba = na){
@@ -1131,10 +1120,12 @@
a->deferhd = (Bptr){-1, -1, -1};
a->defertl = nil;
}
+ packarena(a->b->data, Blksz, a, fs);
+ finalize(a->b);
finalize(a->logtl);
if(syncblk(a->logtl) == -1)
sysfatal("sync arena: %r");
- if(syncarena(a) == -1)
+ if(syncblk(a->b) == -1)
sysfatal("sync arena: %r");
unlock(a);
}