From e25b74ca8069e340c3f2c267d09beed6d9328250 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 1 Sep 2011 10:25:20 -0400 Subject: Fix layout issues for printed version --- log.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'log.c') diff --git a/log.c b/log.c index 6b5c329..ef6c1e7 100644 --- a/log.c +++ b/log.c @@ -76,12 +76,11 @@ install_trans(void) //if (log.lh.n > 0) // cprintf("install_trans %d\n", log.lh.n); for (tail = 0; tail < log.lh.n; tail++) { - // cprintf("put entry %d to disk block %d\n", tail, log.lh.sector[tail]); - struct buf *lbuf = bread(log.dev, log.start+tail+1); // read i'th block from log - struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst block - memmove(dbuf->data, lbuf->data, BSIZE); - bwrite(dbuf); - brelse(lbuf); + struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block + struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst + memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst + bwrite(dbuf); // flush dst to disk + brelse(lbuf); brelse(dbuf); } } @@ -102,7 +101,7 @@ read_head(void) // cprintf("read_head: %d\n", log.lh.n); } -// Write the in-memory log header to disk, committing log entries till head +// Write in-memory log header to disk, committing log entries till head static void write_head(void) { @@ -144,10 +143,10 @@ void commit_trans(void) { 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 + write_head(); // 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 + write_head(); // Reclaim log } acquire(&log.lock); -- cgit v1.2.3