The main differences are that ext2fs uses smaller blocksizes and doesn't support fragments. There are minor differences in the directory format. Furthermore, the allocation policies differ. Ext2fs's policy is mainly extent-based, aiming for contiguous allocation, whereas ffs' policy takes various disk parameters into account to aid its strategy.
A first approach to use the Linux code base and provide it with glue code so that it could use Lites' buffer cache and could be used by Lites' VFS layer failed. The reasons are threefold: first, the buffer cache interfaces are different, second, the amount of glue code for the vfs layer would have been rather large, and finally it would have been necessary to guarantee all the implicit assumptions the ext2fs code makes about the Linux kernel.
Therefore, we decided to start with the ffs code. The translation was then straightforward.
The differences in the directory format required a customized readdir routine, plus customized routines to enter or remove directory entries. Since those routines are not part of the VFS abstract interface, the ufs code dynamically checks the type of the vnode and calls the appropriate function. A second difference is that ext2fs and ffs have different notions of a basic unit in a directory (DIRBLKSIZ). These two changes were the only changes the ufs code suffered; the alternative would have been to clone large parts of the code.
Linux's allocation policies are enforced. This includes preferences of where to allocate blocks and inodes as well as the preallocation of up to eight contiguous blocks that help lay out ext2fs files contiguously under contention. The allocation code was the only code that came from the Linux source. At this point, it includes some i386 specific asm macros which were also taken from Linux.
The mount program can be installed in /usr/sbin
and will work
with the standard BSD mount utility. Specifying a type of ``ext2fs'' in
/etc/fstab
will cause mount_ext2fs
to be invoked.
Unfortunately, fsck
does not have a similar ``escape'' mechanism
to allow non-FFS filesystems to be checked automatically. You will have to
run the ext2fs checker by hand.
The msdosfs support was taken almost as is from the FreeBSD 2.0.5-snapshot 7/26/95. FreeBSD extensions not present in Lites had to be commented out (such as NFS cookies in readdir). Only other minor changes were needed, and these could be incorporated in a single header file.
Jordan K. Hubbard cautioned that it doesn't run reliably in read-write mode
in FreeBSD. He mentioned that "dd if=/dev/zero of=
Even though we were not able to reproduce this failure on our small DOS
partition, please be aware that you're using this software at your risk.
Since the changes to the msdosfs code are really minor, the problem is likely to
occur in Lites as well, unless it lies in another area of FreeBSD's code.
Godmar Back
<gback@cs.utah.edu>
University of Utah, Computer Systems Laboratory
August 29, 1995