Fix layout issues for printed version
This commit is contained in:
parent
15997d5849
commit
e25b74ca80
7 changed files with 55 additions and 57 deletions
19
log.c
19
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue