提交 843eecfc 创建 作者: Austin Clements's avatar Austin Clements

Only commit log to disk if something was written in to it.

Without this, every write to the console results in log writes.
上级 7f1718ca
...@@ -143,10 +143,12 @@ begin_trans(void) ...@@ -143,10 +143,12 @@ begin_trans(void)
void void
commit_trans(void) commit_trans(void)
{ {
if (log.lh.n > 0) {
write_head(); // This causes all blocks till log.head to be commited write_head(); // This causes all blocks till log.head to be commited
install_trans(); // Install all the transactions till head install_trans(); // Install all the transactions till head
log.lh.n = 0; log.lh.n = 0;
write_head(); // Reclaim log write_head(); // Reclaim log
}
acquire(&log.lock); acquire(&log.lock);
log.intrans = 0; log.intrans = 0;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论