cetrafs
ExplanationUnderstanding-oriented

Performance model

Why data throughput is high and metadata operations are slow, what the measurements show, how cetrafs compares with GFS2, OCFS2 and shared LVM, and how to benchmark cetrafs honestly.

Two very different paths

File data goes straight to the disk. A node writes blocks it owns, or blocks of a file it has locked, with no cross-node coordination at all. Contiguous runs are mapped in one call, so a direct read of 2,048 contiguous blocks costs one mapping lookup instead of 2,048. qemu’s cache=none is direct I/O, so this is the path a guest actually uses. Aligned direct overwrites of blocks already written run in parallel, under a shared lock.

Metadata operations are synchronous and coherent across nodes. A create, mkdir or unlink takes ordered compare-and-writes for the namespace lock, reads of directory blocks fresh from the device, and journaled writes. Each of those is a real round trip to the array, and about 40% of an operation is compare-and-writes that have to happen in order and can’t be overlapped.

Measured

Data path, on HPE 3PAR over 32 Gb FC multipath, amd64 Proxmox nodes:

WorkloadcetrafsGFS2, same LUN
dd bs=1M oflag=direct613–710 MB/s283 MB/s
dd bs=1M iflag=direct (read)1.0–1.2 GB/snot measured
dd bs=1M oflag=sync340–424 MB/s241–242 MB/s

4 KiB random O_DIRECT I/O with fio, on an enterprise FC array, one node, a fully written 16 GiB file:

Queue depth 16libaioio_uring
Random write29,207 IOPS25,451 IOPS
Random read47,730 IOPS38,381 IOPS

cetrafs doesn’t advertise non-blocking direct I/O, so io_uring hands every request to a worker thread, which costs 13–20% at depth 16. That is one reason to avoid aio=io_uring for VM disks.

Larger and mixed I/O with fio, O_DIRECT, on an enterprise FC array, median of three runs in each of two sessions:

WorkloadThroughput
1 MiB sequential write, new file, QD8867–941 MiB/s
1 MiB overwrite, QD81186–1217 MiB/s
1 MiB sequential read, QD82538–2691 MiB/s
4 KiB random 70/30 read/write, QD3261,800–64,400 IOPS
8 KiB random 70/30 read/write, 4 jobs × QD3275,100–76,900 IOPS
fallocate of 200 GiB1.14–1.23 s
unlink of that 200 GiB file0.72–0.73 s

Metadata operations, on a 5 GiB iSCSI LUN with atomic CAW:

OperationTime
create~407 ms
mkdir~416 ms
unlink~457 ms
rmdir~513 ms
stat~21 ms
one device read / synchronous write / compare-and-write~5.5 / ~38 / ~36 ms

Compared with GFS2, OCFS2 and shared LVM

In December 2026 the same tests ran on cetrafs 0.10.6, GFS2, OCFS2 and Proxmox shared LVM, on the same FC LUN, the same three Proxmox hosts and the same VM. Every storage was mounted or active on all three hosts; one host did the I/O. Each was freshly formatted, cetrafs with defaults and nofilelock.

LVM isn’t a filesystem: a thick logical volume has no files, no allocation, no thin disks and no qcow2. It is in the tables as a reference for what the device gives with nothing on top.

Inside a VM, on a new 64 GiB test disk, fio 4 KiB random 70/30 at QD1 and 8 KiB random 70/30 at QD32 × 4 jobs:

cetrafsGFS2OCFS2LVM (reference)
raw disk, QD1, read / write IOPS960 / 410705 / 301802 / 343797 / 340
qcow2 disk, QD1, read / write IOPS947 / 405716 / 305514 / 219n/a
raw disk, QD32, read / write MiB/s388 / 166343 / 147441 / 189351 / 151
qcow2 disk, QD32, read / write MiB/s380 / 164321 / 138352 / 151n/a
First fill of 4 × 10 GB on a raw disk100 s233 s127 s92 s, preallocated
qcow2 image extents afterwardsabout 90026,371810n/a

On the host, fio on an 8 GiB file, median of three:

cetrafsGFS2OCFS2LVM (reference)
4 KiB write + fsync, IOPS (mean fsync)1,840 (0.52 ms)1,843 (0.51 ms)1,608 (0.59 ms)1,663 (0.57 ms)
Sequential write into new space370 MiB/s227 MiB/s330 MiB/s671 MiB/s, nothing to allocate
Sequential read, and share of the raw device5,684 MiB/s, 99%5,387 MiB/s, 96%5,145 MiB/s, 99%5,655 MiB/s, 98%
4 KiB random read, QD32, IOPS112,81080,27571,40796,914
4 KiB random write, QD32, IOPS22,75322,57218,80921,937
4 KiB random 70/30, read / write IOPS41,250 / 17,65934,511 / 14,78223,332 / 9,98838,356 / 16,421
4 KiB at QD1, read / write IOPS2,098 / 1,8131,692 / 1,7181,514 / 1,6621,916 / 1,789

On space already allocated, cetrafs runs at the speed of the device: within the spread of raw LVM on random and sequential I/O and on QD1 latency. Among the filesystems it writes new data fastest, and fills a new thin VM disk in about the time LVM writes a preallocated one, in a few hundred extents where GFS2 leaves tens of thousands.

How far to trust it: the four ran one after another over about 11 hours, not interleaved, and the raw device’s own speed moved by up to 19% between runs. The VM tests are single runs (cetrafs’s, the mean of two), and identical runs on this array have differed by more than 15%, so treat smaller differences there as noise. GFS2 ran without fencing, which doesn’t touch the I/O path measured. Several hosts writing at once, failover and metadata-heavy work weren’t measured.

What the safety checks cost

Every extent’s physical address is range-checked before I/O is aimed at it, so an extent that names the inode table or a bitmap is refused instead of written through. A kernel microbenchmark on an FC LUN put the check at about 4 ns per call, and one call covers a whole extent run: over 3 GiB of direct I/O it averaged about 0.1 ns per 4 KiB block.

The self-fencing check adds 0.03 ms to an append (2.4%), 0.6 ms to a create (4.9%) and nothing to a steady-state overwrite.

The test-only switches stay compiled into the release module, so the module the suites prove is the one that ships. The two on the hottest per-block path cost 0.13 and 0.3 ns per block, measured over 32 GiB of buffered writes.

Direct writes into holes

qemu with cache=none writes a thin VM image with O_DIRECT, and the first write to each block of a sparse or preallocated image lands in a hole or in preallocated space. cetrafs keeps those writes direct: a hole is allocated as preallocated space, the data goes straight to the device, and the blocks are marked written only when the write completes, so nothing (a reader, a peer, a crash) can see what they held before. The guest keeps its queue depth. On a 1 Gbit iSCSI node:

O_DIRECT writesThroughput
Random 4 KiB into a hole, QD321,578–1,597 IOPS
Sequential 1 MiB into a hole, QD1694–95 MiB/s (link-bound)
Random 4 KiB into preallocated space, QD321,291–1,296 IOPS
Random 4 KiB overwrite, for reference21,019–21,226 IOPS

Random writes into holes stay far below overwrites: each one changes the extent tree. A first write into preallocated space marks a 64 KiB unit written at a time, so a guest writing in small scattered pieces doesn’t split the extent once per block. Writes smaller than a block (a 512-byte guest sector) wait for each other, as on ext4. dio_fallbacks in info counts direct writes that went through the page cache and should stay at 0.

Zeroing and space reclaim

fallocate(ZERO_RANGE), which qemu uses for write-zeroes requests, zeroes written blocks in place with the SCSI WRITE ZEROES command, without freeing or moving anything. On an FC array, a stream of 1 MiB zeroings from one process ran at 733 per second, 17 times the old punch-and-reallocate path, and left the file’s layout untouched where the old path turned 9 extents into 6,376. A 1 MiB zeroing costs what the raw command does, about 1.2 ms.

UNMAP of an emptied Block Group runs in the background, as the group is handed back. Measured on an FC array with fio running on two nodes, handing back about 35 GiB of Block Groups while files were deleted didn’t move the guests’ IOPS beyond the noise. fstrim of 1 GiB of freed space inside Block Groups took 1.5 s with fio running on both nodes; a first fstrim over 1.5 TiB of unowned Block Groups took 155 s, with the guests on the other node still running. See Return free space to a thin LUN.

Aged images

A buffered write asks for the location of its data one 4 KiB block at a time. On a file rewritten in place for months, the extent-tree leaves cover wide, overlapping ranges, so walking the tree from the top for every block would read several leaves each time: a VM image would slow down as it aged.

So each file remembers several recently found extents, and the blocks that follow are answered from them without walking the tree. A change to the file’s extent map invalidates them. Rewriting 1 GiB at 64 KiB into an already allocated file, on an FC array:

Compact fileFragmented file
Throughput1173 MB/s1091 MB/s

ext_cache_hits and ext_cache_misses in info show whether the cache is working. Several invariants of this kind are guarded by tests that count device reads per operation, so a change that put a tree walk back on every block fails the gate.

Holes in fragmented images

Finding out that a block is a hole is the expensive lookup: it has to read every leaf whose range could cover the block, so its cost grows with the file’s extent count. A thin VM image is exactly that, a large, sparse file that fragments as it is written in place, and both a direct write into a hole and a read of one used to ask block by block.

Since 0.10.3, a direct write into a hole maps the whole request at once, as far as the hole and the file’s reservation reach, and a lookup that finds a hole also works out where it ends, so the following reads are answered without walking the tree. On an FC array, 1 GiB in a file of about 49,000 extents:

BeforeAfterEmpty file, for reference
O_DIRECT 1 MiB write into a hole241 MB/s709–748 MB/s616–696 MB/s
O_DIRECT 1 MiB read of a hole829 MB/s13.0 GB/s14.1–15.8 GB/s
Buffered read of a hole587 MB/s2.0 GB/s2.0–2.1 GB/s

Tree lookups per GiB fell from about 264,000 to 3,200 for the write, and from 262,144 to 1 for the read: a fragmented image now behaves like an empty one. A buffered write into a hole still looks it up per block, and in the same fragmented file runs at about 270–310 MB/s against 1.2–1.5 GB/s in an empty one; with cache=none qemu doesn’t take that path. dio_hole_runs and hole_cache_hits in info show both mechanisms at work.

Read-only opens

A file opened only for reading holds no lock, but nothing it is reading through can be freed while it has the file open (see What a reader sees). So a reader trusts its cached layout between changes to the file, checking once a second whether one has happened, and buffered reads use readahead. That is how a qcow2 backing file, or a base image shared by linked clones, is read. Reading in 1 MiB read() calls on an FC array:

Read-only openThroughput
Default mount, sparse 8 GiB file2051 MB/s
Default mount, 2 GiB of data2361 MB/s
nofilelock, file also open on a second node2393 MB/s

What that means for workloads

The design trades metadata speed for coherence without a lock manager. That fits VM images: a datastore holds a few hundred large files, each opened once and written for months. It fits many small files badly: a build tree, a mail spool or a home directory server would spend its time in metadata round trips. That isn’t what cetrafs is for.

Inside the guest

Most of the gap between a host’s throughput and a guest’s is qemu configuration, not the filesystem. On the same stack, aio=threads against io_uring was worth 30% on raw images and more than 4× on qcow2, and qcow2’s fragmentation adds to that. See Configure VM disks for cetrafs.

Benchmarking honestly

Shared arrays are noisy, and these points have led to wrong conclusions before:

  • Count device I/Os, not only seconds. The deltas in /sys/block/<dev>/stat before and after a run give I/Os per operation, which the array’s load can’t move.
  • Measure the raw device in the same session. The array is shared, and its own throughput moves. In one session the same LUN gave 564 MB/s with dd bs=1M oflag=direct and no filesystem at all, while cetrafs on it gave 470–543 MB/s: 83–96% of a ceiling that was itself below the range in the table above. Without the raw figure, that reads as a 30% regression in cetrafs.
  • Use a new filename for every write run. Rewriting an existing file reuses blocks that are already allocated and never exercises the allocator, so it measures something else.
  • Measure durable writes. A plain buffered dd measures the page cache. Use oflag=direct or oflag=sync.
  • Quote ranges, not single numbers. Two back-to-back runs of the same command on one node have differed by 18% on writes and 28% on reads. A single-run A/B difference smaller than about 30% tells you nothing.
  • Interleave A, B, A, B, and use a ratio (for example write/read throughput in the same session) as the control. Absolute numbers drift with whatever else is using the array; ratios hold steady.
  • Turn off qemu’s detect_zeroes when writing zeroes inside a guest, or qemu drops the writes.
  • A loop device proves nothing about speed. It has no compare-and-write and serves “uncached” reads from the host page cache.

The counters in /proc/fs/cetrafs/<dev>/info show regressions without a profiler: bg_pick_cursor against bg_pick_scan (is allocation scanning?), bg_desc_kept against bg_desc_refreshed (is something dropping the allocator’s cache?), and map_calls against map_blocks (are block mappings coming back in contiguous runs?).

Last updated