ref: 85cd892f0121f21c30f8b65645729c0097ef1429
parent: 912fdf6efa65da2afce022a84f1a59e7c529f528
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 3 15:34:51 EDT 2023
qgen: push down into qput this makes it impossible to miss the queue ordering.
--- a/blk.c
+++ b/blk.c
@@ -894,7 +894,6 @@
qe.op = Qfree;
qe.bp = p->bp;
qe.b = nil;
- qe.qgen = agetv(&fs->qgen);
qput(a->sync, qe);
if(p->b != nil){
setflag(p->b, Bfreed);
@@ -921,7 +920,6 @@
holdblk(b);
finalize(b);
qe.op = Qwrite;
- qe.qgen = agetv(&fs->qgen);
qe.bp = b->bp;
qe.b = b;
qput(a->sync, qe);
@@ -961,6 +959,7 @@
int i;
qlock(&q->lk);
+ qe.qgen = agetv(&fs->qgen);
while(q->nheap == q->heapsz)
rsleep(&q->fullrz);
for(i = q->nheap; i > 0; i = (i-1)/2){