summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-09-25bcachefs: Trivial cleanupKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-24bcachefs: Convert a BUG_ON() to a warningKent Overstreet
We shouldn't ever be writing past i_size - but, apparently there's still a bug to track down. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-23Merge pull request #69 from smuenzel/patch-1koverstreet
Fix flush_dcache_page in filemap.c
2019-09-22bcachefs: Count iterators for reflink_p overwrites correctlyKent Overstreet
In order to avoid trying to allocate too many btree iterators, bch2_extent_atomic_end() needs to count how many iterators are going to be needed for insertions and overwrites - but we weren't counting the iterators for deleting a reflink_v when the refcount goes to 0. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-22bcachefs: Drop unnecessary rcu_read_lock()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-22bcachefs: Update path microoptimizationsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-22bcachefs: Handle bio_iov_iter_get_pages() returning unaligned bioKent Overstreet
If the user buffer isn't aligned to the filesystem block size, on a large enough IO - where it won't fit into a single bio - bio_iov_iter_get_pages() won't necessarily return a bio with the proper alignment. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-22Fix flush_dcache_page in filemap.csmuenzel
2019-09-21bcachefs: Drop unused arg to bch2_open_buckets_stop_dev()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix validation of replicas entriesKent Overstreet
When an extent is erasure coded, we need to record a replicas entry to indicate that data is present on the devices that extent has pointers to - but nr_required should be 0, because it's erasure coded. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Add support for FALLOC_FL_INSERT_RANGEKent Overstreet
Somewhat tricky and ugly, because iterating over extents backwards is a pain. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: bch2_btree_iter_peek_prev()Kent Overstreet
Last of the basic operations for iterating forwards and backwards over the btree: we now have - peek(), returns key >= iter->pos - next(), returns key > iter->pos - peek_prev(), returns key <= iter->pos - prev(), returns key < iter->pos Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Don't write past eofKent Overstreet
When converting from PAGE_SIZE to block_size, the .mkwrite path was missed Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Check for extents past eof correctlyKent Overstreet
bcachefs used to work mostly in terms of PAGE_SIZE, not block size at the vfs level - but that has since been fixed. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Debug assertion improvementsKent Overstreet
Call bch2_btree_iter_verify from bch2_btree_node_iter_fix(); also verify in btree_iter_peek_uptodate() that iter->k matches what's in the btree. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Add missing bch2_btree_node_iter_fix() callKent Overstreet
Any time we're modifying what's in the btree, iterators potentially have to be updated - this one was exposed by the reflink code. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: 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>
2019-09-21bcachefs: More btree iter improvementsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Improve btree_iter_pos_in_node()Kent Overstreet
2019-09-21bcachefs: Debug code improvementsKent Overstreet
.key_debugcheck no longer needs to take a pointer to the btree node Also, try to make sure wherever we're inserting or modifying keys in the btree. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Add missing bch2_btree_node_iter_fix() callsKent Overstreet
With multiple iterators, if another iterator points to the key being modified, we need to call bch2_btree_node_iter_fix() to re-unpack the key into the iter->k Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Optimize calls to bch2_btree_iter_traverse()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix a typoKent Overstreet
_iter, not iter Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Improved bch2_fcollapse()Kent Overstreet
Move extents instead of copying them - this way, we can iterate over only live extents, not the entire keyspace. Also, this means we can mostly skip running triggers. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: __bch2_btree_node_iter_fix() improvementsKent Overstreet
Being more rigorous about noting when the key the iterator currently poins to has changed - which should also give us a nice performance improvement due to not having to check if we have to skip other bsets backwards as much. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Do updates in order they were queued up inKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Drop trans arg to bch2_extent_atomic_end()Kent Overstreet
Just for consistency Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: data move path should not be trying to move reflink_p keysKent Overstreet
This was spotted when the move_extent() path tried to allocate a bio for a reflink_p extent, but adding pages to the bio failed because we overflowed bi_max_vecs. Oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix a null ptr derefKent Overstreet
rbio->c wasn't being initialized in the move path Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Flush fsck errors when looping in btree gcKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Rebalance now adds replicas if neededKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Kill BTREE_INSERT_NOMARK_INSERTKent Overstreet
Was dead code Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix BTREE_INSERT_NOMARK_OVERWRITESKent Overstreet
bch2_mark_update() was correct, but bch2_trans_mark_update() wasn't respecting BTREE_INSERT_NOMARK_OVERWRITES - key marking/triggers really need to be cleaned up. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Improve pointer marking checks and error messagesKent Overstreet
Importantly, we don't want to use bch2_fs_inconsistent_on() for errors that fsck can repair, becuase that will just put us in RO mode and prevent fsck from actually fixing stuff. Probably want to get rid of it in the future. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Switch reconstruct_alloc to a mount optionKent Overstreet
Right now this is the only way of repairing bucket gens in the future Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix fiemap (again)Kent Overstreet
when iterating over reflink pointers, we use the key we just emitted to set the iterator position - which means we have to be setting the key's inode field as well Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix error message on bucket overflowKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Reflink pointers also have to be remarked if split in journal replayKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fixes for replicas trackingKent Overstreet
The continue statement in bch2_trans_mark_extent() was wrong - by bailing out early, we'd be constructing the wrong replicas list to update. Also, the assertion in update_replicas() was wrong - due to rounding with compressed extents, it is possible for sectors to be 0 sometimes. Also, change extent_to_replicas() in replicas.c to match the replicas list we construct in buckets.c. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: 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>
2019-09-21bcachefs: 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>
2019-09-21bcachefs: Optimize fiemapKent Overstreet
Reflink caused fiemap performance to regress badly - this gets us back to where we were. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Add a hint for allocating new stripesKent Overstreet
This way we aren't doing a full linear scan every time we create a new stripe. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Inline some fast pathsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Don't flush journal from bch2_vfs_write_inode()Kent Overstreet
It's only updating timestamps, so this doubly doesn't make sense. fsync will flush the journal, if necessary. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Fix a spurious gcc warningKent Overstreet
*i is used as an output parameter, but gcc isn't noticing that. Oh well. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Handle ec_buf not being page aligned when allocating bioKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Update more code for KEY_TYPE_reflink_vKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Re-enable bkey_debugcheck() in the extent update pathKent Overstreet
Also, move other update path checks to where they actually check all the updates (after triggers have run) Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2019-09-21bcachefs: Check alignment in write pathKent Overstreet
Also - fix alignment in bch2_set_page_dirty() Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>