static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk log.lh.n = 0; write_head(); // clear the log }
static void recover_from_log(void) { read_head(); cprintf("recovery: n=%d\n", log.lh.n); install_trans(); log.lh.n = 0; write_head(); }
static void commit(void) { if (log.lh.n > 0) { write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit install_trans(); // Now install writes to home locations log.lh.n = 0; write_head(); // Erase the transaction from the log } }
void commit_trans(void) { if (log.lh.n > 0) { write_head(); // Write header to disk -- the real commit install_trans(); // Now install writes to home locations log.lh.n = 0; write_head(); // Erase the transaction from the log } acquire(&log.lock); log.busy = 0; wakeup(&log); release(&log.lock); }
void commit_trans(void) { if (log.lh.n > 0) { 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 } acquire(&log.lock); log.intrans = 0; wakeup(&log); release(&log.lock); }