ZV6: A Fork of MIT's XV6, inspired by ZFS
C Shell C++ Assembly Objective-C Perl OpenEdge ABL
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gdbinit.tmpl
.gitignore
BUGS
LICENSE
Makefile
Notes
README
README.md
README.pdf
TRICKS
asm.h
bio.c
bootasm.S
bootmain.c
buf.h
cat.c
cfs.c
console.c
cuth
defs.h
dot-bochsrc
echo.c
elf.h
entry.S
entryother.S
exec.c
fcntl.h
file.c
file.h
forktest.c
fs.c
fs.h
gdbutil
grep.c
ide.c
idesignate.c
init.c
initcode.S
ioapic.c
kalloc.c
kbd.c
kbd.h
kernel.ld
kill.c
lapic.c
ln.c
log.c
ls.c
main.c
memide.c
memlayout.h
mkdir.c
mkdirtree
mkfs.c
mmu.h
mp.c
mp.h
param.h
pcat.c
pchecksum.c
picirq.c
pinode.c
pipe.c
pr.pl
printf.c
printpcs
proc.c
proc.h
rm.c
runoff
runoff.list
runoff.spec
runoff1
sh.c
show1
sign.pl
sleep1.p
spinlock.c
spinlock.h
spinp
stat.h
stressfs.c
string.c
swtch.S
symlink.patch
syscall.c
syscall.h
sysfile.c
sysproc.c
timer.c
toc.ftr
toc.hdr
trap.c
trapasm.S
traps.h
types.h
uart.c
ulib.c
umalloc.c
user.h
usertests.c
usys.S
vectors.pl
vm.c
wc.c
x86.h
zombie.c

README.md

ZV6: A Fork of MIT's XV6, inspired by ZFS

Final project for MIT's Operating System Engineering class. The project goal was to modify the XV6 operating system (itself based on Unix V6) to support ZFS-like file systems features. Namely, we modified XV6 to suport inode-checksums and 'ditto blocks' to replace corrupted files on the spot.

Overview

The major concept that we borrowed from ZFS is that of ditto blocks. A ditto block is a mirror of a file's inode that points to a new set of data blocks that duplicate the original file's content exactly. In our system, each inode has either 0, 1, or 2 ditto blocks. We added child1 and child2 fields to the inode which point to the ditto blocks for a given file.

To determine if a file is corrupted, we implemented a checksum function that takes an inode as an argument. The checksum function iterates over every data block in a file and computes a value that is then stored in the inode and dinode. Then, to determine if a file is corrupted, the checksum is recomputed then compared against the stored value. When attempting to access a file, the ilock operation performs this check. If a file is determined to be corrupted, we attempt to find an uncorrupted version in the ditto blocks. If we find an uncorrupted version, this version propagates to the original inode (and potentially other ditto block) to restore the file. If the file cannot be recovered, the ilock operation will fail with an error code indicating the file to be corrupted.

In order to protect a high proportion of the file system, we automatically protect nodes closer to the root of the file system. Directories within 3 levels of the root are automatically protected with two ditto blocks. Directories within 6 levels of the root are automatically protected with one ditto block.

ZFS

If you are curious to learn more about the awesomeness of ZFS here are a few good places to start: