]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
13 months agobcachefs: Debug code improvements
Kent Overstreet [Sat, 14 Sep 2019 14:47:14 +0000 (10:47 -0400)]
bcachefs: Debug code improvements

.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@linux.dev>
13 months agobcachefs: Add missing bch2_btree_node_iter_fix() calls
Kent Overstreet [Sat, 14 Sep 2019 14:45:46 +0000 (10:45 -0400)]
bcachefs: Add missing bch2_btree_node_iter_fix() calls

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@linux.dev>
13 months agobcachefs: Optimize calls to bch2_btree_iter_traverse()
Kent Overstreet [Sun, 8 Sep 2019 18:00:12 +0000 (14:00 -0400)]
bcachefs: Optimize calls to bch2_btree_iter_traverse()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix a typo
Kent Overstreet [Fri, 13 Sep 2019 18:43:34 +0000 (14:43 -0400)]
bcachefs: Fix a typo

_iter, not iter

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Improved bch2_fcollapse()
Kent Overstreet [Mon, 22 Jul 2019 17:37:02 +0000 (13:37 -0400)]
bcachefs: Improved bch2_fcollapse()

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@linux.dev>
13 months agobcachefs: __bch2_btree_node_iter_fix() improvements
Kent Overstreet [Sat, 7 Sep 2019 23:17:40 +0000 (19:17 -0400)]
bcachefs: __bch2_btree_node_iter_fix() improvements

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@linux.dev>
13 months agobcachefs: Do updates in order they were queued up in
Kent Overstreet [Sat, 7 Sep 2019 18:16:00 +0000 (14:16 -0400)]
bcachefs: Do updates in order they were queued up in

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Drop trans arg to bch2_extent_atomic_end()
Kent Overstreet [Sat, 7 Sep 2019 22:03:56 +0000 (18:03 -0400)]
bcachefs: Drop trans arg to bch2_extent_atomic_end()

Just for consistency

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: data move path should not be trying to move reflink_p keys
Kent Overstreet [Sat, 7 Sep 2019 20:13:20 +0000 (16:13 -0400)]
bcachefs: data move path should not be trying to move reflink_p keys

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@linux.dev>
13 months agobcachefs: Fix a null ptr deref
Kent Overstreet [Sat, 7 Sep 2019 17:16:41 +0000 (13:16 -0400)]
bcachefs: Fix a null ptr deref

rbio->c wasn't being initialized in the move path

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Flush fsck errors when looping in btree gc
Kent Overstreet [Sat, 7 Sep 2019 16:42:27 +0000 (12:42 -0400)]
bcachefs: Flush fsck errors when looping in btree gc

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Rebalance now adds replicas if needed
Kent Overstreet [Sat, 7 Sep 2019 16:39:59 +0000 (12:39 -0400)]
bcachefs: Rebalance now adds replicas if needed

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Kill BTREE_INSERT_NOMARK_INSERT
Kent Overstreet [Thu, 5 Sep 2019 17:37:50 +0000 (13:37 -0400)]
bcachefs: Kill BTREE_INSERT_NOMARK_INSERT

Was dead code

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix BTREE_INSERT_NOMARK_OVERWRITES
Kent Overstreet [Thu, 29 Aug 2019 17:29:31 +0000 (13:29 -0400)]
bcachefs: Fix BTREE_INSERT_NOMARK_OVERWRITES

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@linux.dev>
13 months agobcachefs: Improve pointer marking checks and error messages
Kent Overstreet [Thu, 29 Aug 2019 15:34:01 +0000 (11:34 -0400)]
bcachefs: Improve pointer marking checks and error messages

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@linux.dev>
13 months agobcachefs: Switch reconstruct_alloc to a mount option
Kent Overstreet [Wed, 28 Aug 2019 17:20:31 +0000 (13:20 -0400)]
bcachefs: Switch reconstruct_alloc to a mount option

Right now this is the only way of repairing bucket gens in the future

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix fiemap (again)
Kent Overstreet [Wed, 28 Aug 2019 16:41:45 +0000 (12:41 -0400)]
bcachefs: Fix fiemap (again)

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@linux.dev>
13 months agobcachefs: Fix error message on bucket overflow
Kent Overstreet [Wed, 28 Aug 2019 16:11:39 +0000 (12:11 -0400)]
bcachefs: Fix error message on bucket overflow

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Reflink pointers also have to be remarked if split in journal replay
Kent Overstreet [Wed, 28 Aug 2019 16:05:17 +0000 (12:05 -0400)]
bcachefs: Reflink pointers also have to be remarked if split in journal replay

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fixes for replicas tracking
Kent Overstreet [Thu, 22 Aug 2019 17:20:38 +0000 (13:20 -0400)]
bcachefs: Fixes for replicas tracking

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@linux.dev>
13 months agobcachefs: Refactor bch2_alloc_write()
Kent Overstreet [Tue, 27 Aug 2019 21:45:42 +0000 (17:45 -0400)]
bcachefs: Refactor bch2_alloc_write()

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@linux.dev>
13 months agobcachefs: Trust in memory bucket mark
Kent Overstreet [Tue, 27 Aug 2019 21:34:03 +0000 (17:34 -0400)]
bcachefs: Trust in memory bucket mark

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@linux.dev>
13 months agobcachefs: Optimize fiemap
Kent Overstreet [Thu, 22 Aug 2019 20:12:28 +0000 (16:12 -0400)]
bcachefs: Optimize fiemap

Reflink caused fiemap performance to regress badly - this gets us back
to where we were.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Add a hint for allocating new stripes
Kent Overstreet [Thu, 22 Aug 2019 21:09:16 +0000 (17:09 -0400)]
bcachefs: Add a hint for allocating new stripes

This way we aren't doing a full linear scan every time we create a new
stripe.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Inline some fast paths
Kent Overstreet [Thu, 22 Aug 2019 20:07:37 +0000 (16:07 -0400)]
bcachefs: Inline some fast paths

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't flush journal from bch2_vfs_write_inode()
Kent Overstreet [Thu, 22 Aug 2019 20:30:55 +0000 (16:30 -0400)]
bcachefs: Don't flush journal from bch2_vfs_write_inode()

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@linux.dev>
13 months agobcachefs: Fix a spurious gcc warning
Kent Overstreet [Thu, 22 Aug 2019 20:34:59 +0000 (16:34 -0400)]
bcachefs: Fix a spurious gcc warning

*i is used as an output parameter, but gcc isn't noticing that. Oh well.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Handle ec_buf not being page aligned when allocating bio
Kent Overstreet [Thu, 22 Aug 2019 20:41:50 +0000 (16:41 -0400)]
bcachefs: Handle ec_buf not being page aligned when allocating bio

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Update more code for KEY_TYPE_reflink_v
Kent Overstreet [Thu, 22 Aug 2019 20:23:10 +0000 (16:23 -0400)]
bcachefs: Update more code for KEY_TYPE_reflink_v

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Re-enable bkey_debugcheck() in the extent update path
Kent Overstreet [Thu, 22 Aug 2019 15:17:04 +0000 (11:17 -0400)]
bcachefs: Re-enable bkey_debugcheck() in the extent update path

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@linux.dev>
13 months agobcachefs: Check alignment in write path
Kent Overstreet [Thu, 22 Aug 2019 00:16:42 +0000 (20:16 -0400)]
bcachefs: Check alignment in write path

Also - fix alignment in bch2_set_page_dirty()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix faulty assertion
Kent Overstreet [Thu, 22 Aug 2019 03:52:10 +0000 (23:52 -0400)]
bcachefs: Fix faulty assertion

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix bch2_bkey_narrow_crcs()
Kent Overstreet [Wed, 21 Aug 2019 22:55:07 +0000 (18:55 -0400)]
bcachefs: Fix bch2_bkey_narrow_crcs()

We have to reinitialize ptrs whenever we do something that changes them.
Regression from when the code was converted to be generic across all
keys with pointers.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix bch2_sort_repack_merge()
Kent Overstreet [Wed, 21 Aug 2019 22:35:15 +0000 (18:35 -0400)]
bcachefs: Fix bch2_sort_repack_merge()

bch2_bkey_normalize() modifies the value, and we were modifying the
original value in the src btree node - but, we're called without a write
lock held on the src node. Oops...

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Reflink
Kent Overstreet [Fri, 16 Aug 2019 13:59:56 +0000 (09:59 -0400)]
bcachefs: Reflink

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Refactor bch2_extent_trim_atomic() for reflink
Kent Overstreet [Fri, 16 Aug 2019 13:58:07 +0000 (09:58 -0400)]
bcachefs: Refactor bch2_extent_trim_atomic() for reflink

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Move node iterator fixup to extent_bset_insert()
Kent Overstreet [Tue, 20 Aug 2019 21:46:22 +0000 (17:46 -0400)]
bcachefs: Move node iterator fixup to extent_bset_insert()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix bch2_btree_node_iter_fix()
Kent Overstreet [Tue, 20 Aug 2019 21:43:47 +0000 (17:43 -0400)]
bcachefs: Fix bch2_btree_node_iter_fix()

bch2_btree_node_iter_prev_all() depends on an invariant that wasn't
being maintained for extent leaf nodes - specifically, the node iterator
may not have advanced past any keys that compare after the key the node
iterator points to.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix bch2_btree_node_iter_prev_filter()
Kent Overstreet [Mon, 19 Aug 2019 17:43:01 +0000 (13:43 -0400)]
bcachefs: Fix bch2_btree_node_iter_prev_filter()

bch2_btree_node_iter_prev_filter() tried to be smart about iterating
backwards when skipping over whiteouts/discards - but unfortunately,
doing so can leave the node iterator in an inconsistent state; the sane
solution is to just always iterate backwards one key at a time.

But we compact btree nodes when more than a quarter of the keys are
whiteouts/discards, so the optimization wasn't buying us that much
anyways.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix __bch2_btree_iter_peek_slot_extents()
Kent Overstreet [Sat, 17 Aug 2019 19:54:48 +0000 (15:54 -0400)]
bcachefs: Fix __bch2_btree_iter_peek_slot_extents()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Improved debug checks
Kent Overstreet [Sat, 17 Aug 2019 19:17:09 +0000 (15:17 -0400)]
bcachefs: Improved debug checks

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Rework calling convention for marking overwrites
Kent Overstreet [Fri, 9 Aug 2019 17:01:10 +0000 (13:01 -0400)]
bcachefs: Rework calling convention for marking overwrites

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Mark space as unallocated on write failure
Kent Overstreet [Tue, 13 Aug 2019 07:16:52 +0000 (03:16 -0400)]
bcachefs: Mark space as unallocated on write failure

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Ensure bch2_trans_get_iter() returns iters with correct locks
Kent Overstreet [Mon, 12 Aug 2019 18:35:34 +0000 (14:35 -0400)]
bcachefs: Ensure bch2_trans_get_iter() returns iters with correct locks

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: fix for_each_btree_key()
Kent Overstreet [Fri, 9 Aug 2019 21:12:37 +0000 (17:12 -0400)]
bcachefs: fix for_each_btree_key()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: trans_get_key() now works correctly for extents
Kent Overstreet [Wed, 7 Aug 2019 16:07:13 +0000 (12:07 -0400)]
bcachefs: trans_get_key() now works correctly for extents

More prep work for reflink: for extents, we're not looking for an exact
mach on pos, rather that the pos is within the range of the key the
iterator points to.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Export correct blocksize to vfs
Kent Overstreet [Sat, 29 Jun 2019 21:59:21 +0000 (17:59 -0400)]
bcachefs: Export correct blocksize to vfs

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Truncate/fpunch now works on block boundaries, not page
Kent Overstreet [Tue, 6 Aug 2019 15:19:58 +0000 (11:19 -0400)]
bcachefs: Truncate/fpunch now works on block boundaries, not page

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Count reserved extents as holes
Kent Overstreet [Tue, 30 Jul 2019 18:18:29 +0000 (14:18 -0400)]
bcachefs: Count reserved extents as holes

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Handle partial pages in seek data/hole
Kent Overstreet [Tue, 30 Jul 2019 17:49:17 +0000 (13:49 -0400)]
bcachefs: Handle partial pages in seek data/hole

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Change buffered write path to write to partial pages
Kent Overstreet [Mon, 29 Jul 2019 17:38:38 +0000 (13:38 -0400)]
bcachefs: Change buffered write path to write to partial pages

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Change __bch2_writepage() to not write to holes
Kent Overstreet [Mon, 29 Jul 2019 16:24:36 +0000 (12:24 -0400)]
bcachefs: Change __bch2_writepage() to not write to holes

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix bch2_seek_data()
Kent Overstreet [Tue, 30 Jul 2019 16:46:53 +0000 (12:46 -0400)]
bcachefs: Fix bch2_seek_data()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Refactor various code to not be extent specific
Kent Overstreet [Thu, 25 Jul 2019 17:52:14 +0000 (13:52 -0400)]
bcachefs: Refactor various code to not be extent specific

With reflink, various code now has to handle both KEY_TYPE_extent
or KEY_TYPE_reflink_v - so, convert it to be generic across all keys
with pointers.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Refactor __bch2_cut_front()
Kent Overstreet [Thu, 18 Jul 2019 21:21:21 +0000 (17:21 -0400)]
bcachefs: Refactor __bch2_cut_front()

Minor cleanup - prep work for new key types for reflink

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Dont't call bch2_trans_begin_updates() in bch2_extent_update()
Kent Overstreet [Thu, 18 Jul 2019 21:11:35 +0000 (17:11 -0400)]
bcachefs: Dont't call bch2_trans_begin_updates() in bch2_extent_update()

Prep work for reflink - for reflink, we're going to be using
bch2_extent_update() with other updates in the same transaction.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't unlink iters on unsuccessful commit
Kent Overstreet [Thu, 18 Jul 2019 21:32:20 +0000 (17:32 -0400)]
bcachefs: Don't unlink iters on unsuccessful commit

Where unlink_on_commit is used, on unsuccessfull commit we're likely
retrying the whole update and were going to be using the same iterators
again.

The management of multiple iterators needs to be gone over a fair bit
more at some point...

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: add missing bch2_trans_begin() call
Kent Overstreet [Tue, 23 Jul 2019 22:56:28 +0000 (18:56 -0400)]
bcachefs: add missing bch2_trans_begin() call

for_each_btree_key() calls bch2_trans_get_iter() - we have to reset the
transaction state before getting the iterator again, in the retry path

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Add offset_into_extent param to bch2_read_extent()
Kent Overstreet [Tue, 9 Jul 2019 16:56:43 +0000 (12:56 -0400)]
bcachefs: Add offset_into_extent param to bch2_read_extent()

With reflink, we'll no longer be able to calculate the offset of the
data we want into the extent we're reading from from the extent pos and
the iter pos - we'll have to pass it in separately.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Print out name of bkey type
Kent Overstreet [Tue, 16 Jul 2019 16:23:04 +0000 (12:23 -0400)]
bcachefs: Print out name of bkey type

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't overflow trans with iters from triggers
Kent Overstreet [Tue, 16 Jul 2019 16:06:34 +0000 (12:06 -0400)]
bcachefs: Don't overflow trans with iters from triggers

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Convert some assertions to fsck errors
Kent Overstreet [Sat, 13 Jul 2019 16:59:02 +0000 (12:59 -0400)]
bcachefs: Convert some assertions to fsck errors

Actual repair code will come later, but this is a start

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix ec_stripes_read()
Kent Overstreet [Fri, 12 Jul 2019 21:08:32 +0000 (17:08 -0400)]
bcachefs: Fix ec_stripes_read()

Change it to not mark keys that will be overwritten by keys in the
journal - this fixes a bug where we pop an assertion in
bucket_set_stripe() because of a stale pointer - because the stripe that
has the stale pointer has been deleted.

This code could be factored out and used elsewhere, at some point.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix stripe_idx_to_delete()
Kent Overstreet [Thu, 11 Jul 2019 16:45:59 +0000 (12:45 -0400)]
bcachefs: Fix stripe_idx_to_delete()

There was a null ptr deref when there wasn't a stripes heap allocated

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't try to delete stripes when RO
Kent Overstreet [Wed, 10 Jul 2019 20:04:58 +0000 (16:04 -0400)]
bcachefs: Don't try to delete stripes when RO

We weren't checking for errors when trying to delet stripes, which meant
ec_stripe_delete_work() would spin trying to delete the same stripe over
and over.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Track dirtyness at sector level, not page
Kent Overstreet [Wed, 3 Jul 2019 01:41:35 +0000 (21:41 -0400)]
bcachefs: Track dirtyness at sector level, not page

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Kill page_state_cmpxchg
Kent Overstreet [Tue, 2 Jul 2019 21:25:05 +0000 (17:25 -0400)]
bcachefs: Kill page_state_cmpxchg

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Always touch page state with page locked
Kent Overstreet [Tue, 2 Jul 2019 18:59:15 +0000 (14:59 -0400)]
bcachefs: Always touch page state with page locked

This will mean we don't have to use cmpxchg for modifying page state,
which will simplify a fair amount of code

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix moving compressed data
Kent Overstreet [Tue, 9 Jul 2019 15:16:33 +0000 (11:16 -0400)]
bcachefs: Fix moving compressed data

bio_uncompress_inplace() used to potentially need to extend the bio to
be big enough for the uncompressed data, which has become problematic
with multipage bvecs - but, the move extent path actually already
allocated the bios to be big enough for the uncompressed data.

The promote path needed to be fixed, though.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: kill bio_for_each_contig_segment()
Kent Overstreet [Thu, 4 Jul 2019 07:48:25 +0000 (03:48 -0400)]
bcachefs: kill bio_for_each_contig_segment()

With multipage bvecs it's not needed anymore

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Kill direct access to bi_io_vec
Kent Overstreet [Wed, 3 Jul 2019 23:27:42 +0000 (19:27 -0400)]
bcachefs: Kill direct access to bi_io_vec

Switch to always using bio_add_page(), which merges contiguous pages now
that we have multipage bvecs.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: kill bch2_crc64_update
Kent Overstreet [Wed, 3 Jul 2019 23:36:39 +0000 (19:36 -0400)]
bcachefs: kill bch2_crc64_update

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix for building with old gcc
Kent Overstreet [Tue, 2 Jul 2019 18:12:48 +0000 (14:12 -0400)]
bcachefs: Fix for building with old gcc

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Improve bch2_lock_inodes()
Kent Overstreet [Mon, 24 Jun 2019 22:24:38 +0000 (18:24 -0400)]
bcachefs: Improve bch2_lock_inodes()

Can now be used for the two different types of locks we have so far

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Check for key size > offset
Kent Overstreet [Sat, 29 Jun 2019 22:03:40 +0000 (18:03 -0400)]
bcachefs: Check for key size > offset

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Refactor trans_(get|update)_key
Kent Overstreet [Mon, 24 Jun 2019 21:58:40 +0000 (17:58 -0400)]
bcachefs: Refactor trans_(get|update)_key

these are still pretty ugly...

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Update path now handles triggers that generate more triggers
Kent Overstreet [Mon, 24 Jun 2019 21:50:52 +0000 (17:50 -0400)]
bcachefs: Update path now handles triggers that generate more triggers

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: add inode_generation_to_text method
Kent Overstreet [Mon, 24 Jun 2019 21:55:15 +0000 (17:55 -0400)]
bcachefs: add inode_generation_to_text method

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix array overrun with unknown btree roots
Kent Overstreet [Mon, 24 Jun 2019 22:11:35 +0000 (18:11 -0400)]
bcachefs: Fix array overrun with unknown btree roots

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: fix kasan splat
Kent Overstreet [Tue, 18 Jun 2019 23:37:39 +0000 (19:37 -0400)]
bcachefs: fix kasan splat

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Delete a spurious assertion
Kent Overstreet [Thu, 27 Jun 2019 15:37:46 +0000 (11:37 -0400)]
bcachefs: Delete a spurious assertion

bch_write_op->written used to be a u16, but it's not so the assertion
isn't needed anymore - and 5.1 can send larger bios.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: fix __bch2_xattr_bcachefs_get()
Kent Overstreet [Thu, 13 Jun 2019 15:01:14 +0000 (11:01 -0400)]
bcachefs: fix __bch2_xattr_bcachefs_get()

We were returning -ERANGE when the size of the buffer passed in was
exactly the size of the xattr val

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: use memalloc_nofs_save() for vmalloc allocation
Kent Overstreet [Wed, 12 Jun 2019 01:03:23 +0000 (21:03 -0400)]
bcachefs: use memalloc_nofs_save() for vmalloc allocation

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix promoting to cache devices (durability = 0)
Kent Overstreet [Mon, 10 Jun 2019 15:31:07 +0000 (11:31 -0400)]
bcachefs: Fix promoting to cache devices (durability = 0)

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't allow bkey vals that are too big in extents btree
Kent Overstreet [Mon, 10 Jun 2019 00:32:54 +0000 (20:32 -0400)]
bcachefs: Don't allow bkey vals that are too big in extents btree

Make sure we don't overflow BKEY_PADDED keys

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Reduce BKEY_PADDED usage
Kent Overstreet [Sun, 9 Jun 2019 20:56:29 +0000 (16:56 -0400)]
bcachefs: Reduce BKEY_PADDED usage

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: bkey_merge() now takes bkey_s
Kent Overstreet [Sun, 9 Jun 2019 20:56:16 +0000 (16:56 -0400)]
bcachefs: bkey_merge() now takes bkey_s

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't overflow stack in bch2_extent_merge_inline()
Kent Overstreet [Thu, 30 May 2019 00:06:06 +0000 (20:06 -0400)]
bcachefs: Don't overflow stack in bch2_extent_merge_inline()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix starting copygc when already started
Kent Overstreet [Fri, 24 May 2019 18:45:33 +0000 (14:45 -0400)]
bcachefs: Fix starting copygc when already started

We can sometimes call bch2_dev_read_write() when the device is already
RW (in error paths).

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix an error path in bch2_btree_iter_traverse()
Kent Overstreet [Fri, 24 May 2019 18:33:16 +0000 (14:33 -0400)]
bcachefs: Fix an error path in bch2_btree_iter_traverse()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Improve key marking interface
Kent Overstreet [Fri, 24 May 2019 15:56:20 +0000 (11:56 -0400)]
bcachefs: Improve key marking interface

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Fix cached sectors not being updated on invalidate
Kent Overstreet [Fri, 24 May 2019 15:56:01 +0000 (11:56 -0400)]
bcachefs: Fix cached sectors not being updated on invalidate

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: better BTREE_INSERT_NO_CLEAR_REPLICAS
Kent Overstreet [Tue, 21 May 2019 19:49:56 +0000 (15:49 -0400)]
bcachefs: better BTREE_INSERT_NO_CLEAR_REPLICAS

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: fix a mount error path
Kent Overstreet [Tue, 21 May 2019 17:42:02 +0000 (13:42 -0400)]
bcachefs: fix a mount error path

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: fix bch2_extent_merge()
Kent Overstreet [Tue, 21 May 2019 14:14:54 +0000 (10:14 -0400)]
bcachefs: fix bch2_extent_merge()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Don't use a fixed size buffer for fs_usage_deltas
Kent Overstreet [Wed, 15 May 2019 19:47:43 +0000 (15:47 -0400)]
bcachefs: Don't use a fixed size buffer for fs_usage_deltas

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Rip out old hacky transaction restart tracing
Kent Overstreet [Wed, 15 May 2019 16:37:11 +0000 (12:37 -0400)]
bcachefs: Rip out old hacky transaction restart tracing

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: More work to avoid transaction restarts
Kent Overstreet [Wed, 15 May 2019 14:54:43 +0000 (10:54 -0400)]
bcachefs: More work to avoid transaction restarts

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Avoid spurious transaction restarts
Kent Overstreet [Wed, 15 May 2019 14:08:55 +0000 (10:08 -0400)]
bcachefs: Avoid spurious transaction restarts

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
13 months agobcachefs: Ensure bch2_btree_iter_next() always advances
Kent Overstreet [Wed, 15 May 2019 13:53:27 +0000 (09:53 -0400)]
bcachefs: Ensure bch2_btree_iter_next() always advances

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>