Homework: Logging

Read: log.c.

Hand-In Procedure

Please write up your answers to the exercise below and hand them in to a 6.828 staff member at the beginning of lecture.

Writing with a Log

Insert a print statement in bwrite (in bio.c) so that you get a print every time a block is written to disk:
  cprintf("bwrite sector %d\n", b->sector);
Build and boot a new kernel and run this:
  $ rm README

You should see a sequence of bwrite prints after the rm.

Submit:

  1. The bwrite lines, each annotated with the kind of information that is being written to the disk (e.g., "README's inode", "allocation bitmap"). If the log is being written, note both that the log is being written and also what kind of information is being written to the log.
  2. Mark with an arrow the first point at which, if a crash occured, README would be missing after a reboot (after the call to recover_from_log()).