block locking and tx changes landed

Zach Brown <[email protected]> Mon, 6 Apr 2026 14:50:30 -0700
Newsgroups dev.linux.lists.rpdfs-devel
Message-ID <[email protected]>
I landed the changes to move from the prepare/apply transaction model to
acquiring and modifying blocks sequentially.

The quickest way to see the impact of the new model is probably to look
at rename before and after the change.  Do browse through the commits
that lead us here, though.  It will make the resulting system make a lot
more sense.

Some supporting functionality was brought up to support modifying blocks
individually.  The most interesting, perhaps, is the "place" block
detail.  It describes where a block is in the namespace.  The block
ordering across the network is defined by the place value increasing.
We add functions for working with it, send it over the wire, and store
it in devd's per-block storage.

Flushing starts writes on blocks in place order to avoid deadlocks with
transactions being modified.  This is pretty cool because it keeps
sharing/contention at the block level.  Writers and flushers only block
each other when they're working with the same blocks.

Block freeing advances a bit with a function to free by updating the
dirty block's details to indicate that it's free.  That's all freeing
is, fundamentally.  We need to not send the block data over the wire
when writing the freed block details, though.  And as a practical matter
we'll want to add some bulk requests for write grants to the blocks
being freed.  Until then large frees are a bunch of sequential round
trip write mode request delays.

The gory summary of the kernel commits:

Zach Brown (24):
      rpdfs: remove spaces before tabs in dir
      rpdfs: alloc in one call instead of find/clear
      rpdfs: add rpdfs_names_match
      rpdfs: add _ALREADY_DIRTY block acquire flag
      rpdfs: dirty transaction blocks individually
      rpdfs: refresh and update inodes with handles
      rpdfs: dramatically simplify the transaction
      rpdfs: update mkfs to use block handles
      rpdfs: use block handles in [gs]etattr
      rpdfs: simplify btree api and structure
      rpdfs: update btree io/txn layer
      rpdfs: access dirents with block handles
      rpdfs: access xattrs with block handles
      rpdfs: add place details metadata
      rpdfs: add rpdfs_block_is_dirty
      rpdfs: set place as blocks are allocated
      rpdfs: serialize write handles and flushing
      rpdfs: clean up block acquire conditions
      rpdfs: update blocks per free stripe message
      rpdfs: add block free that updates details
      rpdfs: warn on attempts to acquire bnr 0
      rpdfs: mark blocks dirty as acquired
      rpdfs: add simple btree block checking
      rpdfs: getattr gets crtime from inode info

Over in devd things are a lot more tame.  Mostly it's the addition of
the place metadata.  But then while stressing things I hit problems in
devd's weird implementation of journal replay.  So that's fixed up a
bit.  Along some misc fixes :).

Zach Brown (6):
      rpdfs-progs: add place and message details
      rpdfs-progs: set TCP_NODELAY on connected sockets
      rpdfs-progs: utask block uses caller's dirty lists
      rpdfs-progs: replay journal blocks without commit
      rpdfs-progs: add DECLARE_FLEX_ARRAY lk helper
      rpdfs-progs: update format headers

- z