linux-block.git
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 months agobcachefs: Fix a bug with spinning on the journal
Kent Overstreet [Wed, 15 May 2019 13:49:46 +0000 (09:49 -0400)]
bcachefs: Fix a bug with spinning on the journal

Transactional triggers meant that when we failed to get a journal
reservation, then bailed out into the error path to block on a journal
reservation, the second blocking call into the journal code was asking
for less space, which is not what we want.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Delete duplicate code
Kent Overstreet [Wed, 15 May 2019 13:47:40 +0000 (09:47 -0400)]
bcachefs: Delete duplicate code

Also rename for consistency

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Fix spurious inconsistency in recovery
Kent Overstreet [Tue, 14 May 2019 18:37:11 +0000 (14:37 -0400)]
bcachefs: Fix spurious inconsistency in recovery

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: improved btree locking tracepoints
Kent Overstreet [Tue, 14 May 2019 18:08:23 +0000 (14:08 -0400)]
bcachefs: improved btree locking tracepoints

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: bch2_btree_delete_at_range()
Kent Overstreet [Sat, 11 May 2019 21:36:31 +0000 (17:36 -0400)]
bcachefs: bch2_btree_delete_at_range()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: stripe creation fixes
Kent Overstreet [Mon, 13 May 2019 04:30:02 +0000 (00:30 -0400)]
bcachefs: stripe creation fixes

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Merge extents with checksums
Kent Overstreet [Mon, 13 May 2019 02:23:30 +0000 (22:23 -0400)]
bcachefs: Merge extents with checksums

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: kill BTREE_ITER_NOUNLOCK
Kent Overstreet [Fri, 10 May 2019 21:15:30 +0000 (17:15 -0400)]
bcachefs: kill BTREE_ITER_NOUNLOCK

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Don't pass around may_drop_locks
Kent Overstreet [Fri, 10 May 2019 21:09:42 +0000 (17:09 -0400)]
bcachefs: Don't pass around may_drop_locks

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Kill remaining bch2_btree_iter_unlock() uses
Kent Overstreet [Fri, 10 May 2019 20:09:17 +0000 (16:09 -0400)]
bcachefs: Kill remaining bch2_btree_iter_unlock() uses

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Fix for the stripes mark path and gc
Kent Overstreet [Wed, 8 May 2019 21:56:05 +0000 (17:56 -0400)]
bcachefs: Fix for the stripes mark path and gc

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Redo replicas gc mechanism
Kent Overstreet [Tue, 30 Apr 2019 21:15:39 +0000 (17:15 -0400)]
bcachefs: Redo replicas gc mechanism

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Fix return code from bch2_fs_start()
Kent Overstreet [Mon, 22 Apr 2019 21:47:49 +0000 (17:47 -0400)]
bcachefs: Fix return code from bch2_fs_start()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Don't run fsck by default at mount time
Kent Overstreet [Thu, 18 Apr 2019 00:16:43 +0000 (20:16 -0400)]
bcachefs: Don't run fsck by default at mount time

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: some improvements to startup messages and options
Kent Overstreet [Wed, 17 Apr 2019 22:21:19 +0000 (18:21 -0400)]
bcachefs: some improvements to startup messages and options

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Various improvements to bch2_alloc_write()
Kent Overstreet [Wed, 17 Apr 2019 22:14:46 +0000 (18:14 -0400)]
bcachefs: Various improvements to bch2_alloc_write()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: bch2_trans_mark_update()
Kent Overstreet [Mon, 11 Mar 2019 18:59:58 +0000 (14:59 -0400)]
bcachefs: bch2_trans_mark_update()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: btree_bkey_cached_common
Kent Overstreet [Sat, 6 Jun 2020 16:28:01 +0000 (12:28 -0400)]
bcachefs: btree_bkey_cached_common

This is prep work for the btree key cache: btree iterators will point to
either struct btree, or a new struct bkey_cached.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
8 months agobcachefs: Write out fs usage consistently
Kent Overstreet [Mon, 11 Feb 2019 00:34:47 +0000 (19:34 -0500)]
bcachefs: Write out fs usage consistently

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