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);
  }
}
相關文章
相關標籤/搜索