Skip to content
Falconry Labs
Falconry Drive Help The studio

Writing a file system that writes: what we learned on FSKit

Falconry Labs · 26 November 2026

FSKit is Apple's framework for file systems that run outside the kernel. Reading through it is one thing. Writing through it, with journaling, fsync, USB drives that get pulled and a few hundred thousand files, is another, and there is little written about it yet. Falconry Drive is our NTFS read/write module for macOS 27 on Apple silicon. Its engine first ran as a kernel extension while we built it, and the same code now compiles a second time in user space as the FSKit module. That gives us an honest baseline: same engine, same disks, two places to run it.

These are six lessons we would have liked to be told. Each has what we expected, what happened, what we did, and the evidence. All numbers are medians from our own test kit, on the hardware named in each section, so you can judge them.

1. Kernel-offloaded I/O decides how fast data moves

What we expected

That a module getting every read and write through ReadWriteHandler would be somewhat slower than a kext.

What happened

Every byte crossed the module, and throughput fell to about a third of the kext. FSKit's other path, kernel-offloaded I/O (KOIO), works differently: the module only maps file offsets to device extents and the kernel moves the data itself. Reads were the first win. Writes needed more work. The module has to allocate in blockmapFile and move the file size and valid-data length in completeIO, and it must never write those pages through its own cache, because the kernel holds a newer copy.

external SSD, 3 rounds         kext   FSKit, module I/O   FSKit, KOIO
seq write, buffered MB/s       3496        1168               2705
seq read, cold MB/s            3816        1211               3676
random 4 KiB write, IOPS     320237      101765             175255

That is 2.3 to 3 times faster than module I/O, with sequential writes at 77 % of the kext and reads at 96 %. In a later seven-round run on the same SSD, buffered writes were 2321 against 2764 MB/s (0.84), F_NOCACHE writes and reads were level with the kext, and random 4 KiB writes were 60 % of it (183170 against 304774 IOPS). On a pocket SSD (about 950 MB/s) and an SD card, both engines sat at the device limit.

What we did

New files are KOIO from birth. A file the module cannot hand to the kernel safely (compressed, encrypted, sparse, or with valid data shorter than its size) goes through ReadWriteHandler, and the route is fixed for the life of the vnode. We checked KOIO with a multi-process stress run (552 thousand write maps, no size lag, no errors, content exact after remount), our fsck, and Windows chkdsk, which reported no errors.

The lesson: on FSKit the data path is a design decision, not a tuning knob. Metadata is a different story (lesson 6).

2. A write of 256 KiB can hang forever, and only a restart recovers

What happened

On macOS 27.3 we found that a volume which offers KOIO and also serves some files through ReadWriteHandler can hang a writer. A buffered write that the kernel pushes in one chunk of vfs.generic.lifs.max_inline_io_size bytes (262144 by default) or more to a non-KOIO file never reaches the module. The process sits in uninterruptible sleep, the mount cannot be unmounted even with force, and only a restart recovers. A 200 KiB write works. The stack of the stuck process:

close
 vn_close
  lifs_vnop_close
   cluster_push_err
    cluster_io
     buf_biowait

To reproduce: mount a volume whose module conforms to both the KOIO and the read/write protocols, open a file the module routed away from KOIO, write 256 KiB and close it. Our probe hung three times in a row, and each time ended in a reboot. We have reported it to Apple.

What we did

The workaround is to make sure no write chunk is ever that large. At start, our helper raises max_inline_io_size as far as the kernel accepts (2 MiB on 27.3; 8 MiB and above were refused) and lowers max_write_size and max_ssd_write_size to half of it, 1 MiB. The price is roughly 3 to 5 % of sequential KOIO write speed on our test SSD. Until the limit is raised, the module shows such files as immutable, so a writer gets EPERM at open instead of a hang.

With the workaround in place we probed 256 KiB, 257 KiB, 512 KiB, 1 MiB, twelve 1 MiB writes in a row, an fsync of 1 MiB, a single 2 MiB write and an 8 MiB write. All passed and every unmount was clean. The lesson is a rule we hold ourselves to: a hang that needs a reboot is not acceptable even in theory, so when the platform can do that to us, we make sure it cannot be reached.

3. A disappearing device must never leave a writer stuck

What we expected

That when a USB drive vanishes, every I/O call returns an error.

What happened

Two things we saw broke that assumption. First, in a software-unplug round on a real USB SSD, the module's synchronous pwrite sat in the storage stack forever. The USB layer logged that it aborted one request, but the completion never reached the synchronous write. The writer's F_FULLFSYNC was asleep waiting for the module, and both showed up stuck in a spindump. Second, when a module process is killed under load, the kernel waits forever for answers to its outstanding requests, and the unmount sleeps with it.

What we did

  • No wait is unbounded. Every device call goes through a pool of threads, and the caller waits in one-second slices. Past 60 seconds the request is abandoned.
  • A fatal condition poisons the process instead of aborting it: no more bytes go to the device, the stuck thread unwinds to its entry point and returns EIO, and every later call returns EIO at once. Every handler answers, so the kernel can unmount. The volume on disk is as it would be after a pull at the moment of the last write.

Evidence

We inject the failure: a test makes the Nth device write sleep forever in a pool thread. With a 5-second limit the writer got EIO after 5 to 6 seconds, the abandoned request was counted, and the volume was consistent after replay. The live version, with real writers through FSKit, passed six of six cases: writers ended with EIO within 0 to 7 seconds, unmount did not sleep forever, and the same mount point mounted read/write again. Our unplug runs through FSKit, ten under load and five after idle, ended with a clean replay and no data failures or hangs.

The limits: a pool thread that fell asleep in the kernel stays leaked until the process ends. And the stuck-device case that prompted this happened about once in 16 software unplugs, so we have not yet seen the fix catch it live.

4. fsync on FSKit: what a flush has to wait for

What happened

FSKit's synchronize does not say which file is being flushed. We treated every waited call as a whole-volume sync, the safe reading, and paid for it: a 4 KiB write plus fsync took 8.7 ms against 1.5 ms for the kext, and deleting a tree of 20,000 files took 246 seconds before we grouped the commits.

What we did

A waited synchronize now means what fsync means on the kext: commit the journal, after recording the valid-data length and lazy size of every open file. It no longer writes all metadata home, because the journal holds it. Only files the module itself wrote through its own cache are pushed first. The kernel has already pushed KOIO data by the time synchronize arrives. A full device flush follows when the journal is not live.

external SSD, 4 KiB + fsync     median
FSKit, whole-volume sync        8.72 ms
FSKit, journal commit           1.62 ms
kext, same day                  0.86 ms

In a later seven-round run, fsync was 0.80 ms against 1.36 for the kext. APFS on the same SSD was 0.067 ms.

One bug took longer to find. The module tested whether the sync flags equalled “no wait”, but the kernel sends a different value, “no wait, per file”, for every vnode it recycles. So every recycled vnode went into a group commit: 27,202 syncs in 15.8 seconds in one run. After the fix it was 500, all from the fsync test itself. Check the flags you actually receive.

For durability we ran unplug tests on a disk image through FSKit: ten under load, five after idle, ten with KOIO off. All replayed cleanly with no data failures and no hangs.

5. Caches live as long as a vnode unless you bound them

What happened

A user-space module has no buffer daemon and no pager, so the layer we put under the kext code keeps its own buffer and page caches. Each entry lived as long as its vnode, and the kernel keeps a vnode as long as it likes. The MFT's vnode lives until unmount, so the module grew with every record read. With 100,000 files and a walk, the process peaked at 549 MB, of which about 100 MB were buffers and 46 MB were cached pages of the log and indexes.

What we did

One LRU across all vnodes for clean buffers and another for clean pages, each limited to 64 MiB by default. Dirty and busy buffers are never touched, so write ordering is unaffected. For pages we first had to prove eviction legal. Our layer marks a page dirty only when the commit says so, while the kernel also looks at the hardware modified bit. We audited all 58 places where the kext unmaps a page and found that every successful path that changes one marks it dirty.

The buffer limit took the 100,000-file run from 549 to 472 MB with no change in create time (about 60 seconds). Reworking our own locks, which had cost about 1 KB per item, took a later peak from 592 to 492 MB. What remains is about 5.6 KB per item that the kernel keeps in its vnode cache, mostly the kext's copy of the MFT record and the inode.

Evidence: with the page limit set to a single 16 KiB page, a 6 MB file caused 733 evictions and stayed intact. The stress run with chkdsk reported no errors, and unplug runs (ten under load, five after idle, ten with KOIO off and 14.7 thousand evictions) were clean.

6. Leaving the kernel costs per file, not per byte

What happened

Once data moved at device speed, metadata was what was left. On the same external SSD, seven rounds:

                         kext   FSKit module     APFS
create 20,000 files (s)  1.07          3.72     0.49
rename 20,000 (s)        1.02          8.91     0.79
rm -rf the tree (s)      1.15         10.94     0.59

Each file crosses the kernel-to-module boundary several times: a lookup that misses, a create, a getattr of the parent directory, an open and a close. A profile of 20,000 creates on an image showed our handlers took about 1.9 s of 7.2 s. The rest was the exchange.

What we did

The module no longer asks for open and close, which removes two round trips per file and took creates on the SSD from 7.03 to 3.82 s at the time. A per-vnode hash in our buffer cache cut another 0.9 s on the image. The parent-directory getattr we cannot remove: the kernel drops the directory's attribute cache after every namespace change and asks again, and the only way around it would change authorization semantics. So we accept the cost. Deleting thousands of tiny files is slower than on APFS, and we say so.

It is not slower everywhere. On an SD card the kext writes metadata synchronously to a slow medium. There, creating 20,000 files took 36.5 s on the kext and 7.03 s through the module, and rm -rf took 174.5 s against 21.3 s, because the module batches metadata into the journal. Renaming did not benefit: 1.08 s on the kext against 22.7 s through the module. Large-file speed on the card was the same.

What we would tell the next team

Design the data path first, bound every wait and every cache, and test the unplug case before the happy path. FSKit is young and has sharp edges in the corners a write-heavy module reaches, but a module can get close to a kernel extension for data and live with the cost for metadata. We will keep measuring and publishing what we find.

Try it on your own drives.

Falconry Drive reads and writes NTFS on macOS 27 with Apple silicon. 14 days of full read and write, free.

Download free trial How we test
Falconry Labs
Falconry DriveFAQHelpThe studioBlogPressLicenceRefundsPrivacy

© 2026 Falconry Labs. Software for macOS.
hello@falconrylabs.com · Support: support@falconrylabs.com