diff options
| author | Austin Clements <amdragon@mit.edu> | 2011-08-15 14:11:22 -0400 | 
|---|---|---|
| committer | Austin Clements <amdragon@mit.edu> | 2011-08-15 14:12:35 -0400 | 
| commit | 843eecfcd0c23f2b9466e5c3289c1819950ccb47 (patch) | |
| tree | 732cac1121352c5aa76469ec74cc4999579c2ac3 | |
| parent | 7f1718ca33fb333435b05cd9a0541e6e3b9b7249 (diff) | |
| download | xv6-labs-843eecfcd0c23f2b9466e5c3289c1819950ccb47.tar.gz xv6-labs-843eecfcd0c23f2b9466e5c3289c1819950ccb47.tar.bz2 xv6-labs-843eecfcd0c23f2b9466e5c3289c1819950ccb47.zip | |
Only commit log to disk if something was written in to it.
Without this, every write to the console results in log writes.
| -rw-r--r-- | log.c | 12 | 
1 files changed, 7 insertions, 5 deletions
| @@ -143,11 +143,13 @@ begin_trans(void)  void  commit_trans(void)  { -  write_head();        // This causes all blocks till log.head to be commited -  install_trans();     // Install all the transactions till head -  log.lh.n = 0;  -  write_head();        // Reclaim log - +  if (log.lh.n > 0) { +    write_head();        // This causes all blocks till log.head to be commited +    install_trans();     // Install all the transactions till head +    log.lh.n = 0;  +    write_head();        // Reclaim log +  } +      acquire(&log.lock);    log.intrans = 0;    wakeup(&log); | 
