summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2011-09-01 10:25:20 -0400
committerFrans Kaashoek <[email protected]>2011-09-01 10:25:20 -0400
commite25b74ca8069e340c3f2c267d09beed6d9328250 (patch)
tree81489f3133ad678a0ccd9ff4e0afcffd84cc6173 /log.c
parent15997d58497f4c716c227787acf9591439e5fe9c (diff)
downloadxv6-labs-e25b74ca8069e340c3f2c267d09beed6d9328250.tar.gz
xv6-labs-e25b74ca8069e340c3f2c267d09beed6d9328250.tar.bz2
xv6-labs-e25b74ca8069e340c3f2c267d09beed6d9328250.zip
Fix layout issues for printed version
Diffstat (limited to 'log.c')
-rw-r--r--log.c19
1 files changed, 9 insertions, 10 deletions
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);