ronan.pict Portrait of Ronan Gaillard

Shot on black & white film, developed and scanned by me at home.

Ronan Gaillard's Workshop

Embedded systems, retro computers and sailing, from Saint-Malo. Things I built, and how.

ALWAYS UNDER CONSTRUCTION

Understanding the Fuzix filesystem

30 November 2026

This post is part of my Z80 single-board computer project. The board runs Zunix, my own kernel, inspired by Fuzix. Fuzix is a small Unix for the Z80 and other 8-bit processors. For the disk I picked its filesystem, and Zunix mounts it from a CompactFlash card.

Software changes fast. New ideas come and go, and the tools we used ten years ago already look old. But some pieces hold on, long after the reasons for their shape disappeared. They adapted a little and kept the same skeleton.

The Fuzix filesystem is one of them. Its format is the Unix V7 format from 1979. Only a few field sizes changed, like 16-bit block numbers and longer file names. In 2026 it still runs on homemade boards.

I wanted to really understand this format, so I started to dig into it. Indirect addressing gave me a headache, and double indirect addressing even more. I needed to lay everything out flat. Then the Understanding FAT16 page by ASCII Tweezers made me want to build the same kind of page, to be sure that I understood. It helped me a lot.

All the values below come from real Fuzix disk images. When I write “the kernel”, I mean the Fuzix kernel, not Zunix. We will put our hands in the machine while it runs, from formatting to the repair after a power cut.

The origins of the Fuzix filesystem

A filesystem is everywhere, so you almost never see it. Storage hardware knows nothing about files or folders. It only knows numbered blocks of bytes. The filesystem is the set of algorithms that decides which bytes belong to which file. The table of contents of a book does the same job: it says which pages make which chapter.

In January 1979, Bell Labs published the seventh edition of Unix, called V7, for the PDP-11. Its filesystem fits in a few ideas:

  • a superblock that describes the disk
  • an inode table that describes each file
  • a list of free blocks, stored in the free blocks themselves

The filsys(5) manual page is enough to describe all of it1.

At the end of the 80s, Doug Braun wrote UZI, “Unix Z80 Implementation”, which uses the same format on an 8-bit processor2. UZI has forks: UZI180, UZIX, UZI280. From 2014, Alan Cox merged and extended them, and the result is Fuzix. Its README presents it as “a fusion of various elements from the assorted UZI forks”, extended “from V7 to somewhere in the SYS3 to SYS5.x world”.

The Z80 computes on 8 and 16 bits. The block addresses of V7 were 32 bits wide. Fuzix cut them down to 16 bits, and used the space it gained to make other things bigger. The algorithms stayed almost the same.

I read the differences between V7 and Fuzix in the headers of the two systems:

Unix V7 (1979) Fuzix
block size 512 bytes 512 bytes
block number 32 bits, stored on 3 bytes in the inode3 16 bits
addresses in the inode 13: 10 direct, single, double and triple indirection 20: 18 direct, single and double indirection
inode on disk 64 bytes, 8 per block 64 bytes, 8 per block
directory entry 16 bytes, name of 14 characters 32 bytes, name of 30
root inode 2 1
magic number none 12,742, at the start of the superblock
reserves in the superblock 50 free blocks, 100 free inodes 50 and 50

We will study the 512-byte version of Fuzix, the one in Kernel/blk512.c. It is the most common one4.

The anatomy of a Fuzix disk

A Fuzix filesystem cuts its partition into four zones.

The largest is the data zone, at the end of the disk. It holds the content of all the files, cut into blocks of 512 bytes and scattered around. You cannot read it alone: nothing in it says which block belongs to which file, or even where a file starts. It’s a soup of blocks5.

At the start of the disk, block 0 belongs to nobody. The V7 manual page left it free for a boot program or a disk label, and Fuzix does the same. No file can use it, so the number 0 means “no block” everywhere else.

A free first block can be handy. A simple monitor can easily read it, put it in RAM and boot from it. My monitor fits in my ROM, so I don’t need this.

Block 1 is the superblock, the only block the kernel reads to mount the disk6. It describes all the other zones. It has its own section later, The superblock, field by field.

Then come the blocks of the inode table. An inode is the record of a file: its type, its permissions, its size, its dates and the list of its blocks. A block holds 8 of them. Formatting fixes their number once and for all. If the table is full, you cannot create a file anymore, even if there is space left.

There is no FAT-style allocation table, and no bitmap. A stack in the superblock holds the free blocks, and the rest of the list lives… in free blocks. We will come back to that.

The mkfs tool and the toy disk

To format a disk, you write a superblock, an empty inode table, a root directory and a list of free blocks. The Fuzix tool, mkfs, takes only two numbers: mkfs disk isize fsize. fsize is the total number of blocks. isize is the number of the first data block, which sets the size of the inode table7.

Each extra block of inodes gives you 8 more possible files and 512 fewer bytes of data. Block numbers are 16 bits wide, so a filesystem has at most 65,535 blocks of 512 bytes: 32 MB8.

In the formatting demo below, change the size of the disk or of the inode table, and the content of the superblock changes with it. The demo computes it like Standalone/mkfs.c does. Each field shows a readable value, with its bytes in hexadecimal below. Click on a field to see its details.

Now for the toy disk, which we use for the rest of this post. Its parameters are not very realistic. I chose them so that you can see everything without drowning.

Here are the liberties I took:

  • 64 blocks in total, or 32 KB: the whole disk fits on one screen.
  • Only 2 blocks of inodes (mkfs toy.img 4 64), or 16 inodes, 2 of them reserved.
  • No partition table: we act as if the disk was only the filesystem9.

The disk is still a real one. I built it with the real mkfs and ucp of Fuzix. ucp works on a Fuzix image from Linux or macOS, with a copy of the kernel functions. On it I created /etc, /home, /tmp, /dev and /src, a device /dev/tty1, a few files and a link, and I deleted two files along the way. The fsck of Fuzix finds no fault in it.

Directories and inodes

To read a file, you need to know which blocks it uses. You also need its size, because almost no file is an exact multiple of 512 bytes.

Unix stores this information in two places. The directory maps a name to an inode number, and nothing else. The inode holds all the rest: the size and the block numbers. A directory is itself a file, and an inode describes it. Its content is a series of 32-byte entries: 2 bytes of inode number, 30 bytes of name.

So you need a starting point: the root / is always inode 1. Inode n is in block 2 + n / 8, at byte 64 × (n mod 8).

Below is the toy disk in three views: the directories, the inode table and the data zone. Each line unfolds to show its fields and their bytes. Read /home/hello.c starting from the root, like the kernel does.

You can explore freely, but here are a few points to check for yourself:

  • Names are up to 30 characters long, padded with zeros. Upper case and lower case are distinct, and you can use every byte except / and 010.
  • Each directory starts with . (itself) and .. (its parent). For the root, the two are 1.
  • The inode does not contain the name. /etc/motd and /home/motd both lead to inode 9, and its i_nlink is 2: one file, two names.
  • /dev/tty1 is a device: it has no data, so no blocks. Its i_addr[0] holds the device number, 513 = 0x0201, which means major 2, minor 1.
  • Dates are seconds since 1970 on 32 bits, like on Unix11.
  • After the end of the file, the rest of the block holds only zeros. The kernel zeroes each block before it gives it to a file, so there are never leftovers from an old file.
  • To create a name, ch_link() takes the first entry whose name is empty, so it reuses a deleted slot. On the toy disk, brouillon.txt took the slot that vieux.txt left in /tmp.
  • Each write of ch_link() rounds the size of the directory up to the next block. Its comment says “Update file length to next block”. mkfs creates the root with a size of 64 bytes.

The block addresses of a file

An inode holds 20 block numbers: i_addr[0] to i_addr[19]. The first 18 point directly to the first 18 blocks of the file. 18 × 512 = 9,216 bytes, and most small files stop there.

Beyond that, i_addr[18] points to an indirect block: a block of 512 bytes that holds only block numbers, 256 of them at 16 bits each. And i_addr[19] points to a double indirect block, filled with the numbers of indirect blocks12. As everywhere on the disk, a number 0 means “no block here”.

So a file can have holes. When a read hits a 0 address, the kernel function bmap() returns NULLBLK and allocates nothing. readi() then gives a block of zeros from zerobuf()13. Only a write allocates the block, so a hole takes no space. FAT cannot do this, because a chain cannot skip a cluster.

bmap(), in Kernel/blk512.c, translates “block n of the file” into “block on the disk”. For n ≥ 18, it subtracts 18, reads the indirect block and takes word number n − 18 from it.

Try it in the next exercise: read all of /src/filesys.c. It is the start of the Fuzix kernel file that handles directories and allocation. It is also the only file on the disk big enough to need an indirect block. Start with its inode, then read its blocks in order.

This system is simple and flexible. The trips between the inode and the data are tedious, but the inode fits in 64 bytes. The kernel keeps it in memory as long as the file is open (in its i_tab table), and only reads the indirect block again.

Things to notice:

  • The blocks of a file are not always neighbors. /src/blk512.c uses blocks 10, 11, then 14 to 17. We will see why in File creation and the free list.
  • The indirect block costs one more read, but only beyond 9,216 bytes. The kernel reads a small file with its inode and its blocks, and nothing else.

File deletion

To delete a file, you must remove its name from the directory, free its inode and give back its blocks. Nothing happens in the data zone.

Unlike FAT, Fuzix keeps nothing of the name. unlinki() calls ch_link(), which writes an inode number of 0 and fills the name with zeros. You cannot tell the entry from one that was never used14. Then i_nlink goes to 0. As soon as nobody has the file open, i_deref() frees its blocks with f_trunc(), sets i_mode to 0 and gives back the inode.

On the disk, that makes three blocks to write: the directory, the inode table and the superblock. The kernel does not treat them the same way:

  • wr_inode() writes the inode to the disk at once15.
  • writei() only marks the directory block as dirty in the buffer cache, unless a program opened the file with O_SYNC.
  • The superblock lives in memory, and only sync() writes it.

So in practice, a rm writes the inode first. The directory block can still leave earlier if the cache needs room, so the order is not strictly fixed.

Try it: delete /tmp/brouillon.txt and write the three blocks in the order you want. Then see what fsck would say if the power failed between two writes.

The messages above are real. I built the eight possible disks (each of the three blocks written or not) from the images before and after the real rm. Then I ran the real Fuzix fsck on each one.

Two cases are dangerous.

If the superblock reaches the disk first, it says that block 39 and inode 5 are free while a file still uses them. The next file created could get them, and two files would share the same block. But a rm alone does not produce this disk, because only sync() writes the superblock. And sync() writes the modified inodes before the superblock, then the dirty buffers, all in the same call. So with the Fuzix kernel, this case is unlikely.

If the inode reaches the disk first, the name brouillon.txt leads to an empty inode. This is the case that the kernel normally produces. It is also what my ucp accident produced, a story I tell in Disk repair with fsck. The other cases only lose space until the next fsck.

Nothing happens in the data zone, so right after the deletion the content of a freed block is still on the disk. Other data will replace it later. Until then, a file deleted by mistake stays readable. On the toy disk, block 39 still holds the shopping list of brouillon.txt. But without a name or an inode, you need to know where to look.

File creation and the free list

To write a file is to delete in reverse, with one more step: you must also write the data. Before that, you must find a free inode and free blocks.

For the free blocks, the superblock holds a stack of 50 numbers, s_free, and its height, s_nfree. To allocate a block, blk_alloc() takes the number at the top. To free a block, the kernel puts its number on the top.

The bottom of the stack, s_free[0], is special. The block it points to is free, but it also contains a full stack: a counter and the next 50 numbers. When the kernel takes this block, it first copies its content into the superblock. Then it zeroes the block and gives it away. So the free blocks make a chain, stored in the free blocks themselves16.

The free side is the mirror of that. If the stack already holds 50 numbers, blk_free() copies s_nfree and the 50 numbers of s_free into the block you free, with blkfromk(). It writes that block and sets s_nfree to 0. Then it puts the number of the freed block on the stack. So the freed block becomes the new chain block, the new s_free[0]. mkfs builds the whole chain this way: it frees the blocks one by one.

And when the disk is full? blk_alloc() takes s_free[--s_nfree]. If that number is 0, it is the end of the chain, and there is no free block. The kernel puts the counter back with ++dev->s_nfree and returns the error ENOSPC.

At that moment, s_tfree, the total of free blocks in the superblock, must be 0 too. If it is not, the counters disagree. The kernel prints “blk_alloc: corrupt” and sets s_mounted, the field of the magic number, to 1. The magic number check fails from then on, so this marks the filesystem as corrupt.

The simulator below lets you reach both limits. It starts from the superblock of the toy disk and applies exactly blk_alloc() and blk_free(). Free blocks until the stack is full, and the next freed block becomes the new chain block. On the toy disk it is block 14, which was already the chain block after mkfs. Then allocate everything, until you reach the 0 at the bottom and ENOSPC.

blk_alloc() works on the copy of the superblock in memory17, so it reads nothing from the disk for 49 allocations out of 50. Only the 50th reads the next block of the chain. The block cache is tiny: NBUFS is 5 on the RC2014 platform.

The inode stack

The inodes have their own stack, s_inode, but it is only a shortcut. When it is empty, i_alloc() scans the inode table from the start and records the first 50 free inodes. Then it continues from the top of the stack. The small numbers are at the bottom, so the first inode it gives is the largest. On the toy disk, I created /etc first, and it got inode 15.

A full stack is not a problem for the inodes. i_free() adds 1 to s_tinode, the total of free inodes. It puts the inode number on the s_inode stack only if the stack holds fewer than 50 entries. If the stack is full, it does not record the number at all.

You lose nothing, because the inode table itself says which inodes are free: a free inode has i_mode and i_nlink at 0. The V7 filsys(5) page says the same: “If s_ninode is already NICINODE, don’t bother to enter the freed i-node into any table.”

The inodes can run out too. If the stack is empty and the scan of the inode table finds no free inode, i_alloc() returns ENOSPC. If s_tinode still announced free inodes, it prints “i_alloc: corrupt” instead and also sets s_mounted to 1.

Replay and fragmentation

Replay the creation of the toy disk, command by command. The two stacks change like in the real image: the final state is exactly the state of its superblock.

The free list never tries to keep the blocks of one file together. At the time of bget blk512.c, the stack falls to zero. The kernel takes block 14, which held the rest of the list since mkfs, copies its 50 numbers, then gives it to the file. motd and hello.c already had blocks 12 and 13, so blk512.c is cut in two.

On a disk with platters, each gap cost a move of the read head, which means milliseconds. f_trunc_blocks() makes a small effort: it frees the blocks of a file backwards, so that they come out of the stack in order. Its comment says: “in reverse order […] so that they end up on the freelist in the order we want to allocate them”.

Even so, files fragment over time. On a hard disk, a defragmenter would move the blocks to put each file back in order. The FAT16 page ends with one.

Fuzix has none18. I do not dig into the topic here. My board uses a CF card, where a jump between two blocks costs almost nothing, so I do not really need a defragmenter. fsck still does a small part of the job, and I come back to that in Disk repair with fsck.

A power cut during a creation

A power cut can also interrupt a creation. newfile() writes the new inode with wr_inode() before it adds the name with ch_link(). That order is safe: a crash leaves an inode with no name, which fsck reports as detached. It never leaves a name that leads to an empty inode.

sync() runs at the end of every process: doexit() calls it with the comment “Not necessary, but a good idea.”. I did not find a periodic sync in the kernel.

The superblock, field by field

You already know most of the superblock: the two stacks, their counters and the magic number. Now for the whole block. Block 1 holds one C structure, struct filesys, from Kernel/include/kernel.h. Its fields use the first 221 bytes of the block. Below is block 1 of the toy disk, the one with 64 blocks. Click on a field to read what it does.

I group the fields by purpose here, so the order is not the order on the disk.

The magic number, 12,742 or 0x31C6, is in s_mounted. Three sizes describe the disk. s_fsize is the total number of blocks, 64 here. s_isize is the number of the first data block, 4 here, and the inode table stops just before it. s_shift gives the block size, as 512 × 2^s_shift. It is 0 here, so a block is 512 bytes.

fmount(), in Kernel/filesys.c, reads block 1 and checks these four fields before anything else. It accepts the disk only if s_mounted is 12,742, s_isize is smaller than s_fsize, and s_shift is at most FS_MAX_SHIFT. The fsck tool also knows the magic number with its two bytes swapped, 50,737. When it finds that value, it checks the disk with reversed byte order.

Then comes the free space. The stack of free blocks from File creation and the free list is s_free[50], and its height is s_nfree. On the toy disk, s_nfree is 26. s_free[1] to s_free[25] hold 63 down to 39, and s_free[0] is 0, which means that no chain block follows.

The second stack caches free inode numbers: s_inode[50], with its height in s_ninode. Here it holds 4 of them: 2, 3, 4 and 5. The two totals, s_tfree and s_tinode, say 25 free blocks and 4 free inodes.

The remaining fields hold a date and a state. s_timeh and s_time hold the date of the last change. s_fmod says if the disk is clean or dirty. It is 0 here, and the next section, Disk repair with fsck, tells what the kernel does with it.

While the kernel has the disk mounted, it works on a copy of the superblock in its mount table (struct mount, field m_fs). Only sync() writes that copy back to block 1.

This explains my favorite part of the block. The fields stop at byte 221, but sync() writes all 512 bytes. So what is in the rest?

In Kernel/inode.c, sync() gets its buffer with bread(m->m_dev, 1, 1). The last argument is rewrite, and the comment in bread() says: “If rewrite is set, we are about to write over the entire block, so we don’t need the previous contents”. So the kernel does not read block 1 from the disk. sync() then copies only sizeof(struct filesys) bytes into the buffer and writes the whole block. The rest of block 1 is whatever that buffer held before.

ucp does the same thing, and I filled the toy disk with it. There, the end of block 1 holds a piece of the C source of filesys.c: break; for(curentry = 0; curentry < (BLKSIZE / DIR_LEN).... ucp used that buffer for this file earlier, and the text stayed there.

The stacks keep leftovers too. Above the top of s_inode, the entries still hold old numbers: 6, 7, 10, 9, 10, 11, 12, 13, 14, 15. They are the history of the inodes given out. When the kernel takes a number from a stack, it only lowers the counter and leaves the old value in place.

Fuzix also has official fields for userspace. After struct filesys, the header defines struct filesys_user, a “Superblock with userspace fields that are not kept in the kernel mount table”. It adds a label of 32 bytes (s_label_name) and a disk geometry: heads, cylinders, sectors, skew and sector size. Two bits in s_props, S_PROP_LABEL and S_PROP_GEO, flag them. The Fuzix tool labelfs writes and prints these fields.

Disk repair with fsck

A power cut can leave the disk half modified, and s_fmod is the mark that tells the kernel19. When the kernel mounts a disk for writing, it immediately writes 1 there, “dirty”. A clean unmount sets it back to 2, “clean”. If the kernel finds 1 at the next mount, it prints “warning: mounting dirty file system, forcing r/o.” and mounts the disk read-only20.

Then you must run fsck. The Fuzix one works in five passes:

  1. It checks each inode.
  2. It rebuilds the whole list of free blocks from the blocks that are really in use.
  3. It looks for blocks that two files use.
  4. It walks the directory tree.
  5. It compares the link counters.

It asks a question before each repair.

Pass 2 is the small part of a defragmenter’s job that I promised. In pass 2, fsck rebuilds the free list with the same loop as mkfs: it walks the blocks from s_fsize - 1 down to s_isize. So after a fsck, the stack gives free blocks in increasing order again. The files themselves do not move.

When I prepared this post, I first forgot the exit command at the end of a ucp session. Without it, ucp wrote only the inode blocks of my rm: not the directory, and not the superblock. This is the “inodes only” case from File deletion, and it is the first disk of the small game below.

The rules of the game

You are fsck. The game has two levels.

Easy is the disk from my ucp accident, with the inodes written first. It has three inconsistencies:

  • a lost block, neither free nor used
  • a directory entry that leads to a free inode
  • a wrong counter in the superblock

Hard is the disk with the superblock written first, one of the eight disks of File deletion. It also has three:

  • block 39 is in the free list while brouillon.txt still uses it
  • inode 5 sits in s_inode, the stack of free inodes, while it is still in use
  • s_tinode says 4 free inodes when the table has 3

Use the bar at the top to go from one view to the other. There are three views: the block map (click on a block to read it), the /tmp directory and the superblock. Try to read as few blocks as possible. At the end of each level, the widget shows the real fsck output for that disk.

Conclusion

We could go on for a long time. How does Fuzix mount several partitions? How does a pipe use an inode and never touch the data zone? What happens to s_shift, made for larger blocks, which the Fuzix kernel still refuses at mount time21?

This format is more than forty years old, and the kernel handles it in about 1,500 lines of C. It has no journal, no bitmap and no extents. But you can read all of it with a hex editor and a pencil. I hope this post makes you want to do it on your own board.

As for me, it is time to continue the implementation on Zunix, my Unix for the Z80.

About this post

I wrote this post with the help of Claude, from the source code of Fuzix and Unix V7 and from real disk images. Its structure and its style follow Understanding FAT16 by ASCII Tweezers.

About the method: I compiled mkfs, ucp and fsck from the Fuzix repository (version 0.5). The post embeds these images: the disk right after mkfs toy.img 4 64, the disk before and after the last rm, and the interrupted copy from the fsck section. The page computes all the rest when it reads them.

Source code:

Further reading:

  • Ken Thompson, “UNIX Implementation”, Bell System Technical Journal, 1978.
  • Maurice J. Bach, The Design of the UNIX Operating System, 1986, chapters 4 and 5.

The game uses the WebPlus IBM VGA 8x16 font from The Ultimate Oldschool PC Font Pack by VileR, under the CC BY-SA 4.0 license.

The files of the toy disk: blk512.c and the extract of filesys.c come from the Fuzix kernel (GPL v2). I wrote motd, hello.c, vieux.txt and brouillon.txt for this post.


  1. It still describes the allocation algorithm that Fuzix uses today, almost word for word. We will see it in File creation and the free list. ↩︎

  2. The header of Kernel/include/kernel.h still says “From UZI by Doug Braun and UZI280 by Stefan Nitschke”, and the copyright in the Fuzix boot message starts in 1988. ↩︎

  3. The V7 inode has 24 bytes of fixed fields and char di_addr[40]. 13 addresses of 4 bytes would need 52 bytes. So V7 stores 13 addresses of 3 bytes, to keep the inode at 64 bytes. The comment in ino.h says “39 used; 13 addresses of 3 bytes each”. In memory, a block number is a full 32-bit long (daddr_t). iget() copies each 3-byte address into 4 bytes with a zero top byte. When it writes the inode back, it drops that byte, and it prints “iaddress > 2^24” if the byte was not zero. So V7 addresses stop at 2^24 blocks of 512 bytes, or 8 GB. Indirect blocks keep full 4-byte numbers. That is why a V7 indirect block holds 128 numbers (NINDIR) and a Fuzix one holds 256. ↩︎

  4. There is a variant with 400-byte blocks (blk400.h). It has another magic number, 12,743, and directory entries of 40 bytes. ↩︎

  5. It also holds directories, blocks that are only lists of numbers, and the list of free blocks. Everything that has no fixed place ends up there. ↩︎

  6. At boot, the kernel even sets its clock to the date recorded in the superblock, for lack of a better source. The comment in start.c explains that this way “time goes forward”. It is a V7 habit. The filsys(5) page says: “During a reboot, s_time of the super-block for the root file system is used to set the system’s idea of the time”. ↩︎

  7. Unlike a quick format on DOS, mkfs first writes zeros on all the blocks of the disk, one by one. ↩︎

  8. The off_t type of the kernel has the comment “32MB file and fs size limit”. For more, you need several partitions. The Fuzix README has this line under “What Key Features Are Missing Still”: “Support for > 32MB filesystems (but first figure out how to fsck a giant fs on a slow 8bit micro!)”. ↩︎

  9. On a partitioned CF card, the disk driver adds the start of the partition to each block number. The filesystem only sees its own numbers. ↩︎

  10. A name of exactly 30 characters has no final zero. The name comparison, namecomp(), stops at the 30th character anyway. ↩︎

  11. The three dates of the inode are uint32_t, and i_atime has the comment “Breaks in 2038” in kernel.h. A read calls setftime(ino, A_TIME), which marks the inode dirty. So a plain read ends with an inode write later, unless you mount the disk with MS_NOATIME. On a CF card, that is extra wear. ↩︎

  12. 256 × 256 = 65,536 blocks: more than the whole disk. V7 even had a triple indirection, which is useless here with 16-bit numbers. ↩︎

  13. The comment of zerobuf() in Kernel/devio.c says it is “used when a read() wants to read an unallocated block of a file”. ↩︎

  14. FAT needs its 0xE5 marker because there an entry of all zeros means “end of the directory”. Fuzix always reads all the blocks of a directory, so an empty entry in the middle is not a problem. ↩︎

  15. wr_inode() calls bwritei(), which ends with bfree(buf, 2). The comment of bfree() in Kernel/devio.c gives the meaning of 2: “Caller dirtied buffer and wants it written back now”. ↩︎

  16. blk_alloc() and blk_free() follow the V7 filsys(5) page from 1979 line for line. ↩︎

  17. In kernel.h, struct filesys has the comment “note: exists in mem and on disk”. NBUFS comes from Kernel/platform/platform-rc2014/config.h, with the comment “Number of block buffers”. ↩︎

  18. The Fuzix README lists “Optimisations for disk block/inode allocator (2.11BSD)” under “What Key Features Are Missing Still”. ↩︎

  19. The V7 filsys(5) page says: “The value of s_fmod on disk is likewise immaterial; it is used as a flag to indicate that the super-block has changed and should be copied to the disk during the next periodic update”. Fuzix turned it into a dirty/clean mark. The counters s_tfree and s_tinode changed too. In the V7 filsys.h, they sit under the comment “remainder not maintained by this version of the system”. Fuzix keeps them up to date, and fsck checks them. ↩︎

  20. mkfs and ucp leave s_fmod at 0, a value that kernel.h calls “legacy”. The kernel does not treat it as dirty. ↩︎

  21. mkfs -b can write blocks up to 16 KB, but FS_MAX_SHIFT is 0 by default, so fmount() refuses their s_shift. ↩︎


► Older : Teaching my Fujifilm X-T30 II to Print on an instax Link 3
Back to the home page