Pick up where i left off in april:

- move log into metadata part of disk, so that marking
that the log's blocks are in use falls out for free
- superblock describes the whole disk (sizes and offets)
- sizes and offsets are computed in one place (mkfs) and
the rest of the code refers to the superblock for these values,
instead of recomputing them.
This commit is contained in:
Frans Kaashoek 2015-06-27 12:39:13 -04:00
parent de4af193c8
commit 8320d61be5
7 changed files with 47 additions and 45 deletions

8
log.c
View file

@ -50,17 +50,17 @@ static void recover_from_log(void);
static void commit();
void
initlog(void)
initlog(int dev)
{
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(ROOTDEV, &sb);
log.start = sb.size - sb.nlog;
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = ROOTDEV;
log.dev = dev;
recover_from_log();
}