• Kent Overstreet's avatar
    bcachefs: Journal updates to interior nodes · 6357d607
    Kent Overstreet authored
    Previously, the btree has always been self contained and internally
    consistent on disk without anything from the journal - the journal just
    contained pointers to the btree roots.
    
    However, this meant that btree node split or compact operations - i.e.
    anything that changes btree node topology and involves updates to
    interior nodes - would require that interior btree node to be written
    immediately, which means emitting a btree node write that's mostly empty
    (using 4k of space on disk if the filesystemm blocksize is 4k to only
    write perhaps ~100 bytes of new keys).
    
    More importantly, this meant most btree node writes had to be FUA, and
    consumer drives have a history of slow and/or buggy FUA support - other
    filesystes have been bit by this.
    
    This patch changes the interior btree update path to journal updates to
    interior nodes, after the writes for the new btree nodes have completed.
    Best of all, it turns out to simplify the interior node update path
    somewhat.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    6357d607
btree_io.c 44.1 KB