Commit Graph
2307 Commits
Author SHA1 Message Date
Zach BrownandZach Brown ac3466921a scoutfs: invalidate stale bloom blocks
We need to invalidate old stale blocks we encounter when reading old
bloom block references written by other nodes.  This is the same
consistency mechanism used by btree blocks.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:02:06 -08:00
Zach BrownandZach Brown 65724c6724 scoutfs: forest comment update
A quick update of the comment describing the forest's use of the bloom
filter block.  It used to be a tree of bloom filter items.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:02:06 -08:00
Zach BrownandZach Brown e8b0bbc619 scoutfs: remove unused counters
Remove a bunch of unused counters which have accumulated over time as
we've worked on the code and forgotten to remove counters.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:02:06 -08:00
Zach BrownandZach Brown debac8ab06 scoutfs: free all forest iter pos
Forest item iteration allocates iterator positions for each tree root
it reads from.  The postorder destruction of the iterator nodes wasn't
quite right because we were balancing the nodes as they were freed.
That can change parent/child relationships and cause postorder iteration
to skip some nodes, leaking memory.  It would have worked if we just
freed the nodes without using rb_erase to balance.

The fix is to actually iterate over the rbnodes while using the destroy
helper which rebalances as it frees.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:02:06 -08:00
Zach BrownandZach Brown e9e515524b scoutfs: remove unused corruption sources
Remove a bunch of constants for sources of corruption that are no longer
used in the code.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:02:06 -08:00
Zach BrownandZach Brown 247e22f56f scoutfs-utils: remove unused corruption sources
Remove the definitions and descriptions of sources of corruption that
are no longer identified by the kernel module.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:01:54 -08:00
Zach BrownandZach Brown 3c7d1f3935 scoutfs-utils: quick forest bloom comment update
Signed-off-by: Zach Brown <zab@versity.com>
2020-03-05 09:01:54 -08:00
Zach BrownandZach Brown 91c64dfa2d scoutfs-utils: print packed extents
Add support for printing the invidual extents stored in packed extent
items.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-02 12:11:39 -08:00
Zach BrownandZach Brown 53f29d3f2a scoutfs-utils: add ilog2() helper
It's handy to use ilog2 in the format header for defining shifts based
on values.  Add a userspace helper that uses glibc's log2 functions.

Signed-off-by: Zach Brown <zab@versity.com>
2020-03-02 12:11:39 -08:00
Zach BrownandZach Brown 7cf8d01c1b scoutfs: fix super read error race
The conversion to reading the super with buffer_head IO caused racing
readers to risk spurious errors.  Clearing uptodate to force device
access could race with a current waking reader.  They could wake and
find uptodate cleared and think that an IO error had occurred.

The buffer_head functions generally require higher level serialization
of this kind of use of the uptodate bit.  We use bh_private as a counter
to ensure that we don't clear uptodate while there are active readers.
We then also use a private buffer_head bit to satisfy batches of waiting
readers with each IO.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-28 11:34:02 -08:00
Zach BrownandZach Brown d374a7c06f scoutfs: fix up radix block _first tracking
Updating the _first tracking in leaf bits was pretty confusing because
we tried to mashing all the tracking updates from all leaf modifications
into one shared code path.

It had a bug where merging would advance _first tracking by the number
of bits merged in the leaf rather than the number of contiguous set bits
after the new first.  This lead to allocation failures eventually as
_first was after actual set bits in the leaf.

This fixes that by moving _first tracking updates into the leaf callers
that modify bits and to the parent ref updating code.

In the process we also fix little bugs in the support code that were
found by the radix block consistency checking.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-28 11:34:02 -08:00
Zach BrownandZach Brown 6eac823bd3 scoutfs: add radix block metadata checker
Add a quick runtime check of the consistency of the radix block and
reference metadata fields.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-28 11:34:02 -08:00
Zach BrownandZach Brown c10c7d9748 scoutfs: clean up forest lock data
The client lock code forgot to call into the forest to clear its
per-lock tracking before freeing the lock.  This would result in a slow
memory leak over time as locks were reclaimed by memory pressure.  It
shouldn't have affected consistency.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-28 11:34:02 -08:00
Zach BrownandZach Brown 757ee85520 scoutfs: don't lose block wakeups
The block end_io path could lose wakeups.  Both the bio submission
task and a bio's end_io completion could see an io_count > 1 and neither
would set the block uptodate before dropping their io_count and waking.

It got into this mess because readers were waiting for io_count to drop
to 0.  We add a io_busy bit which indicates that io is still in flight
which waiters now wait for.  This gives the final io_count drop a chance
to do work before clearing io_busy and dropping their reference before
waking.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-28 11:34:02 -08:00
Zach BrownandZach Brown 3308bf8d8c scoutfs-tests: use fallocate to get large extent
The simple-release-extents test wanted to create a file with a single
large extent, but it did it with a streaming write.  While we'd like
our data allocator to create a large extent from initial writes, it
certainly doesn't guarantee it.  Fallocate is much more likely to
createa a large extent.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:44 -08:00
Zach BrownandZach Brown cce20dbeb6 scoutfs-tests: only check for new dmesg entries
The dmesg check was creating false positives when unexpected messages
from before the test run were forced out of the ring.  The evicted
messages were showing up as removals in the diff.

We only want to see new messages that were created during the test run.
So we format the diff to only output added lines.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:44 -08:00
Zach BrownandZach Brown 503011b777 scoutfs-tests: prepend our paths to PATH
We add directories of our built binaries for tests to find.  Let's
prepend them to PATH so that we find them before any installed
binaries in the system.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:44 -08:00
Zach BrownandZach Brown ec782fff8d scoutfs-utils: meta and data free blocks
The super block now tracks free metadata and data blocks in separate
counters.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:17 -08:00
Zach BrownandZach Brown 6b66e583f2 scoutfs-utils: fix printing block hdr fields
The block header printing helper had the identifiers for the blkno and
seq in the format string swapped.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:17 -08:00
Zach BrownandZach Brown ff436db49b scoutfs-utils: add support for radix alloc
Add support for initializing radix allocator blocks that describe free
space in mkfs and support for printing them out.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:17 -08:00
Zach BrownandZach Brown 34c3d903d9 scoutfs-utils: add round_down() and flsll()
Add quick helpers for these two kernel functions.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:04:17 -08:00
Zach BrownandZach Brown 44a7e2ab56 scoutfs: more carefully handle alloc cursors
The first pass at the radix allocator wasn't paying a lot of attention
to the allocation cursors.

This more carefully manages them.  They're only advanced after
allocating.  Previously the metadata alloc cursor was advanced as it
searched through leaves that it might allocate from.  We test for
wrapping past the specific final allocatable bit, rather than the limit
of what the radix height can store.  This required pushing knoweldge of
metadata or data allocs down through some of the code paths.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 76ed627548 scoutfs: reclaim freed metadata blocks in server
Reclaim freed metadata blocks in the server by merging the stable freed
tree into the allocator as a commit opens and we can trust that the
stable version of the freed allocator in the super is a strict subset of
the allocator's dirty freed tree.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 093f8ead58 scoutfs: refactor server commit locking
Server processing paths had open coded management of holding and
applying transactions.  Refactor that into hold_commit() and
apply_commit() helpers.  It makes the code a whole lot clearer and gives
us a place in hold_commit() to add code that needs to be run before
anything is modified in a commit on the server.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown ce7f7bdbd3 scoutfs: reclaim client log allocators
The server now consistently reclaims free space in client allocator
radix trees.  It merges the client's freed trees as the client
opens a new transaction.  And it reclaims all the client's trees
when it is removed.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 5b6401b5cd scoutfs: add missed btree block freeing
The conversion of the btree to using allocators missed freeing blocks in
two places.  As we overwrite dirty new blocks we weren't freeing the old
stable block as its reference was overwritten.  And as we removed the
final item in the tree we weren't freeing the final empty block as it's
removed.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 128a2c64f4 scoutfs: restore df/statfs block counts
The removal of extent allocators in the server removed the tracking of
total free blocks in the system as extents were allocated and freed.

This restores tracking of total free blocks by observing the difference
in each allocator's sm_total count as a new version is stored during a
commit on the server.

We change the single free_blocks counter in the super to separate counts
of free metadata and data blocks to reflect the metadata and data
allocators.  The statfs net command is updated.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 300b7bc3ba scoutfs: remove allocators that used btree items
Now that we have the allocators that use radix blocks we can remove all
the code that was using btree items to store free block bitmaps.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 85142dcadf scoutfs: use radix allocator
Convert metadata block and file data extent allocations to use the radix
allocator.

Most of this is simple transitions between types and calls.  The server
no longer has to initialize blocks because mkfs can write a single
radix parent block with fully set parent refs to initialize a full
radix.  We remove the code and fields that were responsible for adding
uninitialized data and metadata.

The rest of the unused block allocator code is only ifdefed out.  It'll
be removed in a separate patch to reduce noise here.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 455a547e8e scoutfs: add radix allocator
Add the allocator that uses bits stored in the leaves of a cow radix.
It'll replace two metadata and data allocators that were previously
storing allocation bitmap fragments in btree items.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 8681f920e0 scoutfs: add scoutfs_block_move
Add a call to move a block's location in the cache without failure.  The
radix allocator is going to use this to dirty radix blocks while making
atomic changes to multipls paths through multiple radix trees.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 809d4be58e scoutfs: switch block cache to rbtree
Switch the block cache from indexing blocks in a radix tree to using an
rbtree.  We lose the RCU lookups but we gain being able to move blocks
around in the cache without allocation failure.  And we no longer have
the problem of not being able to index large blocks with a 32bit long
radix key.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 05a8573054 scoutfs: add block visited bit
Add functions for callers to maintain a visited bit in cached blocks.
The radix allocator is going to use this to count the number of clean
blocks it sees across paths through the radix which can share parent
blocks.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 10fd4fcec0 scoutfs: verify read bloom block ref
The bloom block reading code forgot to test if the read block was stale.
It would trust whatever it read.  Now the read when building up roots to
use can return stale and retry.

Signed-off-by: Zach Brown <zab@versity.com>
2020-02-25 12:03:46 -08:00
Zach BrownandZach Brown 794277053f scoutfs-utils: add a few more man pages
Add an overview man page for scoutfs and add a manpage for the userspace
utility and its commands.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-20 14:25:16 -08:00
Zach BrownandZach Brown 4c225c2061 scoutfs-tests: add -y for xfstests args
Add a -y argument so we can specify additional args to ./xfstests, and
clean up our xfstest a bit while we're in there.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 1ce084fcd9 scoutfs-tests: mount-unmount-race describe skip
Add a message describing when mount-unmount-race has to be skipped
because it doesn't have enough mounts to unmount while maintaining
quorum.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 7dc3d7d732 scoutfs-tests: fix t_require_mounts
t_require_mounts never actually did anything because bash is the best.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 89fcb207a7 scoutfs-tests: remove segment-cache-fwd-back-iter
The segment-cache-fwd-back-iter test only applied to populating the item
cache from segments, and we don't do that anymore.  The test can
be removed.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 3ce6061907 scoutfs-tests: offer ftrace printk and dump opts
Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 12b00d0058 scoutfs-tests: create dir in 0 mount
When running a test we only create the test dir through one mount, but
we were off-by-one when deciding that we were iterating through the
first mount.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:23:03 -08:00
Zach BrownandZach Brown 920fca752c scoutfs-utils: have xattr use max val size
Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:22:04 -08:00
Zach BrownandZach Brown e0a49c46a7 scoutfs-utils: add packed extents and bitmaps
Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:22:04 -08:00
Zach BrownandZach Brown c87a9f3a07 scoutfs-utils: resurrect bitops
We've had these in the past and we need them again for the block
allocator item bitmaps.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:22:04 -08:00
Zach BrownandZach Brown 3776c18c66 scoutfs-utils: switch to btree forest
Remove all the lsm code from mkfs and print, replacing
it with the forest of btrees.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:22:04 -08:00
Zach BrownandZach Brown 5ed1cb3aaf scoutfs: remove LSM from README.md
Update the summary of the benefit we get from concurrent per-mount
commits.  Instead of describing it specifically in terms of LSM we
abstract it out a bit to make it also true of writing per-mount log
btrees.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:21:36 -08:00
Zach BrownandZach Brown e034ffa7e9 scoutfs: fix forest iteration
The forest item iterator was missing items.  Picture the following
search pattern:

 - find a candidate item to return in a root
 - ignore a greater candidate to return in another root
 - find the first candidates item's deletion in another root

The problem was that finding the deletion item didn't reset the notion
that we'd found a key.  The next item from the second root was never
used because the found key wasn't reset and that root had already
searched past the found key.

The core architectural problem is that iteration can't examine each item
only once given that keys and deletions can be randomly distributed
across the roots.

The most efficient way to solve the problem is to really sort the
iteration positions in each root and then walk those in order.  We
get the right answer and pay some data structure overhead to perform
the minimum number of btree searches.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:21:36 -08:00
Zach BrownandZach Brown 85178efa19 scoutfs: add more forest tracing
Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:21:36 -08:00
Zach BrownandZach Brown 587120830d scoutfs: initialize transaction block writer
As we shut down the transaction tries to destroy any remaining dirty
blocks in its writer context.  The block writer context was only
initialized by the client as it asked the server for the log trees.

This makes sure the writer is always initialized.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:21:36 -08:00
Zach BrownandZach Brown 3978bbd23f scoutfs: have xattr use max val size
The xattr code had a static defintion of the largest part item that it
would create.  Change it to be a function of the largest fs item
value that can be created and clean up the code a bit in the process.

Signed-off-by: Zach Brown <zab@versity.com>
2020-01-17 11:21:36 -08:00