Page MenuHomeFreeBSD

ext2fs: Multi-block allocator with extent tree support and allocation lifecycle state machine
Needs ReviewPublic

Authored by pfg on Sun, Sep 20, 11:09 PM.
Tags
None
Referenced Files
F172960490: D59866.diff
Tue, Sep 22, 10:35 AM
Unknown Object (File)
Mon, Sep 21, 11:25 AM
Unknown Object (File)
Mon, Sep 21, 8:53 AM
Unknown Object (File)
Mon, Sep 21, 4:53 AM
Unknown Object (File)
Mon, Sep 21, 12:07 AM
Unknown Object (File)
Sun, Sep 20, 11:52 PM
Subscribers

Details

Reviewers
fsu
mckusick
jhb
Summary

The idea was to have an allocator that uses better the locality information and would be better suited for extents and it ended being similar to what linux calls a multiblock allocator in a paper from 2005.
I have never seem the code and I doubt the specific implementation has any similarity.

Implement ext2_alloc_run() — a multi-block physical allocator that
reserves a contiguous physical block run and returns it via a
context-based state machine:

ALLOCATED -> MAPPED -> PUBLISHED -> ROLLED_BACK

ext2_alloc_run() enforces the reserved-block policy using struct
ucred *cred (NOCRED panics under INVARIANTS). Callers include
ext2_alloc() and ext4_new_blocks() for block allocation.

ext4_ext_split() uses scalar ext2_rollback_unpublished() for metadata
block cleanup (no context arrays). ext4_ext_insert_extent() handles
MAPPED -> PUBLISHED state transitions with the context on extent
insertion success.

The allocation context tracks only essential state:

  • physical run (start + length)
  • lifecycle state (4 values)
  • accounting_applied (needed for ALLOCATED -> ROLLED_BACK)

Note 1: I used poolside/laguna-s-2.1:free AI to help the implementation of this algorithm,
It was instructed specifically NOT to take code from linux. Plus I had to review an fix it several times.
Note 2: I have a WIP implementation of softupdates on top of it.

Test Plan

I tested this with fsx : no failures.
I ran dbench with 8 clients and the results are marginally better, not too
impressive, but perhaps it had something to do that I did in a ZVOL,
which is the only thing based on a spinning disk here.
It is also likely this helps with fragmentation: ext3/4 has turned off reallocblk.

Oldalloc:
Throughput 3850.7 MB/sec 8 clients 8 procs max_latency=26.015 ms

Newalloc:
Throughput 3964.99 MB/sec 8 clients 8 procs max_latency=11.642 ms

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

pfg requested review of this revision.Sun, Sep 20, 11:09 PM
pfg edited the test plan for this revision. (Show Details)
pfg edited the summary of this revision. (Show Details)