summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-06-15percpu ifdefswipKent Overstreet
2021-06-15bcachefs: Add BCH_DATA_reservedKent Overstreet
This lets us simplify struct bch_fs_usage and related code a bit. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: Write out shorter JSET_ENTRY_dev_usage entriesKent Overstreet
We don't need to write out the entries for the last data type(s) if they're zeroes - and the next patch is going to be increasing BCH_DATA_NR, so this is needed to avoid the next patch being an on disk format change. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: Add a fastpath to bch2_disk_reservation_add()Kent Overstreet
The new fastpath uses this_cpu_cmpxchg() to avoid having to disable preemption or take c->mark_lock. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15locking improvementsKent Overstreet
2021-06-15bcachefs: BTREE_ITER_COWKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: Keep a sorted list of btree iteratorsKent Overstreet
This will be used to make other operations on btree iterators within a transaction more efficient, and enable some other improvements to how we manage btree iterators. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15fixup! bcachefs: More topology repair codeKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: Don't disable preemption unnecessarilyKent Overstreet
Small improvements to some percpu utility code. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: Extensive triggers cleanupsKent Overstreet
- We no longer mark subsets of extents, they're marked like regular keys now - which means we can drop the offset & sectors arguments to trigger functions - Drop other arguments that are no longer needed anymore in various places - fs_usage - Drop the logic for handling extents in bch2_mark_update() that isn't needed anymore, to match bch2_trans_mark_update() - Better logic for hanlding the BTREE_ITER_CACHED_NOFILL case, where we don't have an old key to mark Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15bcachefs: fix truncate with ATTR_MODEKent Overstreet
After the v5.12 rebase, we started oopsing when truncate was passed ATTR_MODE, due to not passing mnt_userns to setattr_copy(). This refactors things so that truncate/extend finish by using bch2_setattr_nonsize(), which solves the problem. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-15fixup! bcachefs: Improve iter->should_be_lockedKent Overstreet
2021-06-14bcachefs: Improve iter->should_be_lockedKent Overstreet
Adding iter->should_be_locked introduced a regression where it ended up not being set on the iterator passed to bch2_btree_update_start(), which is definitely not what we want. This patch requires it to be set when calling bch2_trans_update(), and adds various fixups to make that happen. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-14bcachefs: Kill __btree_delete_at()Kent Overstreet
With trans->updates2 gone, we can now drop this helper and use bch2_btree_delete_at() instead. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-14bcachefs: Make sure bch2_trans_mark_update uses correct iter flagsKent Overstreet
Now that bch2_btree_iter_peek_with_updates() has been removed in favor of BTREE_ITER_WITH_UPDATES, we need to make sure it's not used where we don't want it. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-14bcachefs: Fix a memory leak in dio write pathKent Overstreet
Commit c42bca92be928ce7dece5fc04cf68d0e37ee6718 "bio: don't copy bvec for direct IO" changed bio_iov_iter_get_pages() to point bio->bi_iovec at the incoming biovec, meaning if we already allocated one, it'll be leaked. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-13bcachefs: fix a possible bcachefs checksum mapping error opt-checksum enum ↵jpsollie
to type-checksum enum This fixes some rare cases where the metadata checksum option specified may map to the wrong actual checksum type. Signed-Off By: Janpieter Sollie <janpieter.sollie@edpnet.be>
2021-06-13bcachefs: Clear iter->should_be_locked in bch2_trans_resetKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-13bcachefs: Don't underflow c->sectors_availableKent Overstreet
This rarely used error path should've been checking for underflow - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-12bcachefs: Kill bch2_btree_iter_peek_cached()Kent Overstreet
It's now been rolled into bch2_btree_iter_peek_slot() Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-12bcachefs: Allow shorter JSET_ENTRY_dev_usage entriesKent Overstreet
If the last entry(ies) would be all zeros, there's no need to write them out - the read path already handles that. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-12bcachefs: mount: fix null deref with null devnameDan Robertson
- Fix null deref on mount when given a null device name. - Move the dev_name checks to return EINVAL when it is invalid. Signed-off-by: Dan Robertson <dan@dlrobertson.com>
2021-06-12bcachefs: Fix null ptr deref when splitting compressed extentsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-11fixup! bcachefs: More topology repair codeKent Overstreet
2021-06-11bcachefs: Fix overflow in journal_replay_entry_earlyKent Overstreet
If filesystem on disk was used by a version with a larger BCH_DATA_NR thas the currently running version, we don't want this to cause a buffer overrun. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Always zero memory from bch2_trans_kmalloc()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Merging for indirect extentsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Improved extent mergingKent Overstreet
Previously, checksummed extents could only be merged when the checksum covered only the currently live data. xfstest generic/064 creates a test file, then uses finsert calls to split the extent, then collapse calls to see if they get merged. But without any reads to trigger the narrow_crcs path, each of the split extents will still have a checksum for the entire original extent. This patch improves the extent merge path so that if either of the extents we're attempting to merge has a checksum that covers the entire merged extent, we just use that checksum. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Re-implement extent merging in transaction commit pathKent Overstreet
We haven't had extent merging in quite some time. It used to be done by the btree code when sorting btree nodes, but that was eliminated as part of the work to separate extent handling from core btree code. This patch re-implements extent merging in the transaction commit path. We don't currently have the ability to merge reflink pointers, we need to do some work on the triggers code to be able to do that without ending up with incorrect refcounts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Clean up key mergingKent Overstreet
This patch simplifies the key merging code by getting rid of partial merges - it's simpler and saner if we just don't merge extents when they'd overflow k->size. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Kill trans->updates2Kent Overstreet
Now that extent handling has been lifted to bch2_trans_update(), we don't need to keep two different lists of updates. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Simplify reflink triggerKent Overstreet
Now that we only mark entire extents, we can ditch the "reflink_p_frag_references" code. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Move extent_handle_overwrites() to bch2_trans_update()Kent Overstreet
This lifts handling of overlapping extents out of __bch2_trans_commit() and moves it to where we first do the update - which means that BTREE_ITER_WITH_UPDATES can now work correctly in extents mode. Also, this patch reworks how extent triggers work: previously, on partial extent overwrite we would pass this information to the trigger, telling it what part of the extent was being overwritten. But, this approach has had too many subtle corner cases - now, we only mark whole extents, meaning on partial extent overwrite we unmark the old extent and mark the new extent. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: BTREE_ITER_WITH_UPDATESKent Overstreet
This drops bch2_btree_iter_peek_with_updates() and replaces it with a new flag, BTREE_ITER_WITH_UPDATES, and also reworks bch2_btree_iter_peek_slot() to respect it too. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Child btree iteratorsKent Overstreet
This adds the ability for btree iterators to own child iterators - to be used by an upcoming rework of bch2_btree_iter_peek_slot(), so we can scan forwards while maintaining our current position. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Drop all btree locks when submitting btree node readsKent Overstreet
As a rule we don't want to be holding btree locks while submitting IO - this will improve overall filesystem latency. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: More topology repair codeKent Overstreet
This improves the handling of overlapping btree nodes; now, we handle the case where one btree node completely overwrites another. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-10bcachefs: Fix a buffer overrunKent Overstreet
In make_extent_indirect(), we were allocating too small of a buffer for the new indirect extent. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Don't mark superblocks past end of usable spaceKent Overstreet
bcachefs-tools recently started putting a backup superblock at the end of the device. This causes a problem if the bucket size doesn't divide the device size - but we can fix it by just skipping marking that part. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Fix a spurious debug mode assertionKent Overstreet
When we switched to using bch2_btree_bset_insert_key() for extents it turned out it started leaving invalid keys around - of type deleted but nonzero size - but this is fine (if ugly) because they're never written out. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Fix unitialized use of a valueBrett Holman
2021-06-09bcachefs: do not compile acl mod on minimal configDan Robertson
Do not compile the acl.o target if BCACHEFS_POSIX_ACL is not enabled. Signed-off-by: Dan Robertson <dan@dlrobertson.com>
2021-06-09bcachefs: btree_iter->should_be_lockedKent Overstreet
Add a field to struct btree_iter for tracking whether it should be locked - this fixes spurious transaction restarts in bch2_trans_relock(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Improve btree iterator tracepointsKent Overstreet
This patch adds some new tracepoints to the btree iterator code, and adds new fields to the existing tracepoints - primarily for the iterator position. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Preallocate transaction memKent Overstreet
This helps avoid transaction restarts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Check for errors from bch2_trans_update()Kent Overstreet
Upcoming refactoring is going to change bch2_trans_update() to start returning transaction restarts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs; Check for allocator thread shutdownKent Overstreet
We were missing a kthread_should_stop() check in the loop in bch2_invalidate_buckets(), very occasionally leading to us getting stuck while shutting down. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Journal space calculation fixKent Overstreet
When devices have different bucket sizes, we may accumulate a journal write that doesn't fit on some of our devices - previously, we'd underflow when calculating space on that device and then everything would get weird. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Don't fragment extents when making them indirectKent Overstreet
This fixes a "disk usage increased without a reservation" bug, when reflinking compressed extents. Also, there's no good reason for reflink to be fragmenting extents anyways. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-06-09bcachefs: Fsck for reflink refcountsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>