ref: 32fe6dfac597a31f823cb0fc069fc29794b87b95
parent: 576bf82b1b825d719a53c069da74d81ca7517dcb
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Aug 3 19:23:46 EDT 2025
gefs patch: make wstat(nulldir) sync the fs wstat(5) suggests this as a an optional feature, and I think it's a good idea to have. This will act as a barrier, but other operations will still be able to toss things down the write queue while we wait for stuff to sync.
--- a/sys/src/cmd/gefs/dat.h
+++ b/sys/src/cmd/gefs/dat.h
@@ -412,6 +412,7 @@
char new[128];
int flag;
char delete;
+ Fmsg *m;
};
struct { /* AOsetcfg AOclrcfg */
char snap[128];
@@ -586,7 +587,6 @@
Bfree *bfree;
RWLock flushq[Nflushtab];
- int flushop[Nflushtab];
Trace *trace;
long traceidx;
--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -319,8 +319,7 @@
v = agetl(&c->count);
if(v == 0 || !acasl(&c->count, v, v-1))
- while(semacquire(&c->count, 1) == -1)
- continue;
+ semacquire(&c->count, 1);
lock(&c->rl);
a = *c->rp;
if(++c->rp >= &c->args[c->size])
@@ -1659,6 +1658,12 @@
p += 4;
}
}
+ if(op == 0 && rename == 0){
+ *ao = emalloc(sizeof(Amsg), 1);
+ (*ao)->op = AOsync;
+ (*ao)->m = m;
+ goto Noupdate;
+ }
op |= Owmuid;
n.muid = f->uid;
PACK32(p, n.muid);
@@ -1722,15 +1727,17 @@
if(rename)
cpkey(de, &k, de->buf, sizeof(de->buf));
+ r.type = Rwstat;
+ respond(m, &r);
+
if(*ao != nil)
poperror();
+Noupdate:
wunlock(de);
poperror();
putfid(f);
poperror();
- r.type = Rwstat;
- respond(m, &r);
}
/* fsclunk: must not raise error() */
@@ -2756,6 +2763,7 @@
char buf[Kvmax];
Msg mb[Kvmax/Offksz];
Bptr bp, nb, *oldhd;
+ Fcall r;
int i, nm;
vlong off;
Tree *t;
@@ -2844,7 +2852,11 @@
epochclean();
}
}
-
+ if(am->m != nil){
+ assert(am->m->type == Twstat);
+ r.type = am->m->type + 1;
+ respond(am->m, &r);
+ }
poperror();
break;
--
⑨