Only commit log to disk if something was written in to it.
Without this, every write to the console results in log writes.
This commit is contained in:
parent
7f1718ca33
commit
843eecfcd0
1 changed files with 7 additions and 5 deletions
12
log.c
12
log.c
|
@ -143,11 +143,13 @@ begin_trans(void)
|
||||||
void
|
void
|
||||||
commit_trans(void)
|
commit_trans(void)
|
||||||
{
|
{
|
||||||
write_head(); // This causes all blocks till log.head to be commited
|
if (log.lh.n > 0) {
|
||||||
install_trans(); // Install all the transactions till head
|
write_head(); // This causes all blocks till log.head to be commited
|
||||||
log.lh.n = 0;
|
install_trans(); // Install all the transactions till head
|
||||||
write_head(); // Reclaim log
|
log.lh.n = 0;
|
||||||
|
write_head(); // Reclaim log
|
||||||
|
}
|
||||||
|
|
||||||
acquire(&log.lock);
|
acquire(&log.lock);
|
||||||
log.intrans = 0;
|
log.intrans = 0;
|
||||||
wakeup(&log);
|
wakeup(&log);
|
||||||
|
|
Loading…
Reference in a new issue