This lifts the restriction that 0 size extents must not overlap with
other extents, which means we can now sort extents and non extents the
same way, and will let us simplify a bunch of other stuff as well.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
working on getting rid of all the reasons bch2_insert_fixup_extent() can
fail/stop partway, which is needed for other refactorings.
One of the reasons we could have to bail out is if we're splitting a
compressed extent we might need to add to our disk reservation - but we
can check that before actually starting the insert.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Due to compression, the different replicas of a replicated extent don't
necessarily have to take up the same amount of space - so replicated
data sector counts shouldn't be stored divided by the number of
replicas.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
gc lock must be held while invalidating buckets - fixes
"1f7a95698e bcachefs: Invalidate buckets when writing to alloc btree"
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Also improve error reporting - only return an error from
bch2_journal_flush_seq() if we had an error writing that entry (i.e. not
if there was an error with a newer entry).
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Prep work for persistent alloc information. Refactoring also lets us
make free_inc much smaller, which means a lot fewer buckets stranded on
freelists.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
journal_buf_switch is called from the foreground when getting a journal
reservation and thus is somewhat latency sensitive;
bch2_bucket_seq_cleanup has to run infrequently but is a bit expensive
when it does run.
Call it from the journal write path instead, and punt the journal write
to worqueue context.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This is prep work for using deferred btree updates for inode updates -
the way inodes are done now we're relying on btree locking for ei_inode
and ei_update_lock could probably be removed, but it'll actually be
needed when we switch to deferred updates.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
ei_update_lock isn't currently needed for write inode (but it will be
needed again when deferred btree updates are used for inode updates)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
exceptionally crappy "tracing", but it's a start at documenting the
places restarts can be triggered
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Now that all filesystem operatinos that manipulate the filesystem
heirachy and i_nlink are fully atomic, we can add a feature bit to
indicate i_nlink doesn't need to be checked.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Initially forked from drivers/md/bcache, bcachefs is a new copy-on-write
filesystem with every feature you could possibly want.
Website: https://bcachefs.org
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>