ref: ebaad2dcaf73e2259c1b236304e7d092b55a5ff5
parent: 34b6e3f626d9c4e0671b942ed304d5f0adab86bb
author: 9ferno <[email protected]>
date: Mon Nov 28 23:15:41 EST 2022
sleep to avoid balloc() running the flush immediately
--- a/9p.c
+++ b/9p.c
@@ -354,7 +354,6 @@
mpsrvpid == 0 &&
lastflushtime < nsec()-Nrefresh){
fsflush();
- lastflushtime = nsec();
}
}
@@ -1062,10 +1061,17 @@
void
fsflush(void)
{
+ u64 now;
+
+ /* this loop is to avoid balloc() calling it immediately
+ again and again */
+ while(lastflushtime > (now=nsec())-Nrefresh)
+ sleep((lastflushtime-(now-Nrefresh))/Nsec);
if(canwlock(&flushlck)){
flushold();
wunlock(&flushlck);
}
+ lastflushtime = now;
}
void