summaryrefslogtreecommitdiff
path: root/kernel/log.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2019-08-01 15:46:50 -0400
committerFrans Kaashoek <[email protected]>2019-08-01 15:46:50 -0400
commit62ece4b09e6a568ede0e3b524af959194e0cb792 (patch)
tree72553e7a6c57a3298193b288db07eb1a4eab17d0 /kernel/log.c
parentfb8a0099d48643775d0bca626af1a73a3ab618a4 (diff)
parent9c4f62e8e3e7f114c6f82a75579a815e6329d767 (diff)
downloadxv6-labs-62ece4b09e6a568ede0e3b524af959194e0cb792.tar.gz
xv6-labs-62ece4b09e6a568ede0e3b524af959194e0cb792.tar.bz2
xv6-labs-62ece4b09e6a568ede0e3b524af959194e0cb792.zip
Merge branch 'riscv-bcache' into riscv
Diffstat (limited to 'kernel/log.c')
-rw-r--r--kernel/log.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/log.c b/kernel/log.c
index c8f7e62..59984db 100644
--- a/kernel/log.c
+++ b/kernel/log.c
@@ -77,6 +77,7 @@ install_trans(void)
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
+ bunpin(dbuf);
brelse(lbuf);
brelse(dbuf);
}
@@ -203,7 +204,7 @@ commit()
}
// Caller has modified b->data and is done with the buffer.
-// Record the block number and pin in the cache with B_DIRTY.
+// Record the block number and pin in the cache by increasing refcnt.
// commit()/write_log() will do the disk write.
//
// log_write() replaces bwrite(); a typical use is:
@@ -227,9 +228,10 @@ log_write(struct buf *b)
break;
}
log.lh.block[i] = b->blockno;
- if (i == log.lh.n)
+ if (i == log.lh.n) { // Add new block to log?
+ bpin(b);
log.lh.n++;
- b->flags |= B_DIRTY; // prevent eviction
+ }
release(&log.lock);
}