MIT6.828 Fall2018 笔记 - Homework 11: xv6 log

Homework: xv6 loghtml

commit函数中write_log();已经把数据从缓冲区拷贝到log中,因此咱们能够直接在install_trans函数里将log中的数据写入磁盘。函数

static void
install_trans(void)
{
  int tail;

  for (tail = 0; tail < log.lh.n; tail++) {
    // struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
    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
    // brelse(lbuf);
    brelse(dbuf);
  }
}
相关文章
相关标签/搜索