summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
AgeCommit message (Collapse)Author
2020-06-28bcachefs: Rename some constants to avoid conflicts with bcacheKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-17bcachefs: Add a kthread_should_stop() check to allocator threadKent Overstreet
Turns out it's possible during shutdown for the allocator to get stuck spinning on bch2_invalidate_buckets() without hitting any of the other checks. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-15bcachefs: Increase size of btree node reserveKent Overstreet
Also tweak the allocator to be more aggressive about keeping it full. The recent changes to make updates to interior nodes transactional (and thus generate updates to the alloc btree) all put more stress on the btree node reserves. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-15bcachefs: Use cached iterators for alloc btreeKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Always increment bucket gen on bucket reuseKent Overstreet
Not doing so confuses copygc Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Kill old allocator startup codeKent Overstreet
It's not needed anymore since we can now write to buckets before updating the alloc btree. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Fixes for going ROKent Overstreet
Now that interior btree updates are fully transactional, we don't need to write out alloc info in a loop. However, interior btree updates do put more things in the journal, so we still need a loop in the RO sequence. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Don't require alloc btree to be updated before buckets are usedKent Overstreet
This is to break a circular dependency in the shutdown path. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Interior btree updates are now fully transactionalKent Overstreet
We now update the alloc info (bucket sector counts) atomically with journalling the update to the interior btree nodes, and we also set new btree roots atomically with the journalled part of the btree update. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Fix reading of alloc info after unclean shutdownKent Overstreet
When updates to interior nodes started being journalled, that meant that after an unclean shutdown, until journal replay is done we can't walk the btree without overlaying the updates from the journal. The initial btree gc was changed to walk the btree overlaying keys from the journal - but bch2_alloc_read() and bch2_stripes_read() were missed. Major whoops... Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Fixes for startup on very full filesystemsKent Overstreet
- Always pass BTREE_INSERT_USE_RESERVE when writing alloc btree keys - Don't strand buckest on the copygc freelist until after recovery is done and we're starting copygc. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: btree_and_journal_iterKent Overstreet
Introduce a new iterator that iterates over keys in the btree with keys from the journal overlaid on top. This factors out what the erasure coding init code was doing manually. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Split out btree_trigger_flagsKent Overstreet
The trigger flags really belong with individual btree_insert_entries, not the transaction commit flags - this splits out those flags and unifies them with the BCH_BUCKET_MARK flags. Todo - split out btree_trigger.c from buckets.c Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Kill BTREE_INSERT_ATOMICKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Initialize padding space after alloc bkeyJustin Husted
Packed bkeys are padded up to 64 bit alignment, but the alloc bkey type was not clearing the pad bytes after the last data byte. This left the key possibly containing some random garbage at the end. This problem was found using valgrind. This patch also changes a path with the inode bkey to clear in the same way. Signed-off-by: Justin Husted <sigstop@gmail.com>
2020-06-09bcachefs: Fix flushing held btree writes when there's a fs errorKent Overstreet
Previously, we'd go into an infinite loop. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Kill deferred btree updatesKent Overstreet
Will be replaced by cached btree iterators Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Avoid deadlocking on the allocatorKent Overstreet
The allocator needs to make sure there's buckets available on the RESERVE_NONE freelist if at all possible - otherwise foreground IO will get stuck. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Refactor bch2_alloc_write()Kent Overstreet
Major simplification - gets rid of the need for marking buckets as dirty, instead we write buckets if the in memory mark is different from what's in the btree. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Trust in memory bucket markKent Overstreet
This fixes a bug in the journal replay -> extent_replay_key -> split_compressed path, when we do an update that changes alloc info but the alloc info in the btree isn't up to date yet. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Rework calling convention for marking overwritesKent Overstreet
2020-06-09bcachefs: Improve key marking interfaceKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: More work to avoid transaction restartsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Fix spurious inconsistency in recoveryKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Various improvements to bch2_alloc_write()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: bch2_trans_mark_update()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Return errors from for_each_btree_key()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Fix hang while shutting downKent Overstreet
If the allocator thread exited before bch2_dev_allocator_stop() was called (because of an error), bch2_dev_allocator_quiesce() could hang. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: lockdep fix when going rw from bch2_alloc_write()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Deduplicate keys in the journal before replayKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: cmp_int()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Pass flags arg to bch2_alloc_write()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: add ability to run gc on metadata onlyKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-06-09bcachefs: Initial commitKent Overstreet
Fork of drivers/md/bcache Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>