Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bcachefs: fix initial page state after falloc #249

Open
wants to merge 790 commits into
base: testing
Choose a base branch
from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Jun 9, 2021

  1. bcachefs: Kill reflink option

    An option was added to control whether reflink support was on or off
    because for a long time, reflink + inline data extent support was
    missing - but that's since been fixed, so we can drop the option now.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    eedba9b View commit details
    Browse the repository at this point in the history
  2. bcachefs: Fix a btree iterator leak

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0000eb6 View commit details
    Browse the repository at this point in the history
  3. bcachefs: Kill btree_iter_pos_changed()

    this is used in only one place now, so just inline it into the caller.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    421c083 View commit details
    Browse the repository at this point in the history
  4. bcachefs: Add a print statement for when we go read-write

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    68e2feb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9ad857b View commit details
    Browse the repository at this point in the history
  6. bcachefs: Fix btree iterator leak in extent_handle_overwrites()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    058bb7a View commit details
    Browse the repository at this point in the history
  7. bcachefs: Fsck code refactoring

    Change fsck code to always put btree iterators - also, make some flow
    control improvements to deal with lock restarts better, and refactor
    check_extents() to not walk extents twice for counting/checking
    i_sectors.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    979db61 View commit details
    Browse the repository at this point in the history
  8. bcachefs: btree_iter_set_dontneed()

    This is a bit clearer than using bch2_btree_iter_free().
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    049d47f View commit details
    Browse the repository at this point in the history
  9. bcachefs: Require all btree iterators to be freed

    We keep running into occasional bugs with btree transaction iterators
    overflowing - this will make those bugs more visible.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    521bd0b View commit details
    Browse the repository at this point in the history
  10. bcachefs: Assert that iterators aren't being double freed

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    012c691 View commit details
    Browse the repository at this point in the history
  11. bcachefs: Kill bkey ops->debugcheck method

    This code used to be used for running some assertions on alloc info at
    runtime, but it long predates fsck and hasn't been good for much in
    ages - we can delete it now.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    f67ffc8 View commit details
    Browse the repository at this point in the history
  12. bcachefs: Don't overwrite snapshot field in bch2_cut_back()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a323cdd View commit details
    Browse the repository at this point in the history
  13. bcachefs: Validate bset version field against sb version fields

    The superblock version fields need to be accurate to know whether a
    filesystem is supported, thus we should be verifying them.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    931da4c View commit details
    Browse the repository at this point in the history
  14. bcachefs: Don't unconditially version_upgrade in initialize

    This is mkfs's job. Also, clean up the handling of feature bits some.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0edf1f2 View commit details
    Browse the repository at this point in the history
  15. bcachefs: Fix iterator picking

    comparison was wrong
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2ea9ffb View commit details
    Browse the repository at this point in the history
  16. bcachefs: Optimize bch2_btree_iter_verify_level()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    cc34d11 View commit details
    Browse the repository at this point in the history
  17. bcachefs: Switch extent_handle_overwrites() to one key at a time

    Prep work for snapshots
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    428d3b4 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    39cc509 View commit details
    Browse the repository at this point in the history
  19. bcachefs: Replace bch2_btree_iter_next() calls with bch2_btree_iter_a…

    …dvance
    
    The way btree iterators work internally has been changing, particularly
    with the iter->real_pos changes, and bch2_btree_iter_next() is no longer
    hyper optimized - it's just advance followed by peek, so it's more
    efficient to just call advance where we're not using the return value of
    bch2_btree_iter_next().
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d500d73 View commit details
    Browse the repository at this point in the history
  20. bcachefs: Have btree_iter_next_node() use btree_iter_set_search_pos()

    btree node iterators need to obey the regular btree node invarionts
    w.r.t. iter->real_pos; once they do, bch2_btree_iter_traverse will have
    less that it needs to check.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    db3cbc6 View commit details
    Browse the repository at this point in the history
  21. bcachefs: Iterators are now always consistent with iter->real_pos

    This means bch2_btree_iter_traverse_one() can be made more efficient.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    225f02f View commit details
    Browse the repository at this point in the history
  22. bcachefs: Kill btree_iter_peek_uptodate()

    Since we're no longer doing next() immediately followed by peek(), this
    optimization isn't doing anything anymore.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ff0c3d1 View commit details
    Browse the repository at this point in the history
  23. bcachefs: Internal btree iterator renaming

    This just gives some internal helpers some better names.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    85624e5 View commit details
    Browse the repository at this point in the history
  24. bcachefs: Improve iter->real_pos handling

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e7c28d3 View commit details
    Browse the repository at this point in the history
  25. bcachefs: Consolidate bch2_btree_iter_peek() and peek_with_updates()

    Ideally we'll be getting rid of peek_with_updates(), but the callers
    will need to be checked.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    04ec8e2 View commit details
    Browse the repository at this point in the history
  26. bcachefs: Update iter->real_pos lazily

    peek() has to update iter->real_pos - there's no need for
    bch2_btree_iter_set_pos() to update it as well.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2e33af1 View commit details
    Browse the repository at this point in the history
  27. bcachefs: Include snapshot field in bch2_bpos_to_text

    More prep work for snapshots.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    bf1bf0e View commit details
    Browse the repository at this point in the history
  28. bcachefs: Add an .invalid method for bch2_btree_ptr_v2

    It was using the method for btree_ptr_v1, but that wasn't checking all
    the fields.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    bde7a53 View commit details
    Browse the repository at this point in the history
  29. bcachefs: Improve inode deletion code

    It had some silly redundancies.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    07d8dda View commit details
    Browse the repository at this point in the history
  30. bcachefs: Split btree_iter_traverse and bch2_btree_iter_traverse()

    External (to the btree iterator code) users of bch2_btree_iter_traverse
    expect that on success the iterator will be pointed at iter->pos and
    have that position locked - but since we split iter->pos and
    iter->real_pos, that means it has to update iter->real_pos if necessary.
    
    Internal users don't expect it to modify iter->real_pos, so we need two
    separate functions.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    468fd24 View commit details
    Browse the repository at this point in the history
  31. six locks: pcpu mode

    This adds a mode to six locks where readers use percpu counters -
    avoiding writing to shared cachelines.
    
    The algorithm is the same as the existing percpu-rwsemaphore's slowpath
    algorithm: taking a read lock still requires a memory barrier to check
    if we raced with another thread taking a write lock, but this means that
    taking a write lock doesn't incur the cost of an RCU barrier.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d59f2ad View commit details
    Browse the repository at this point in the history
  32. bcachefs: Use pcpu mode of six locks for interior nodes

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    cd2baf2 View commit details
    Browse the repository at this point in the history
  33. bcachefs: Increase default journal size

    The default was 1/256th of the device and capped at 512MB, which is
    fairly tiny these days.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5a50b37 View commit details
    Browse the repository at this point in the history
  34. bcachefs: Drop bkey noops

    Bkey noops were introduced to deal with trimming inline data extents in
    place in the btree: if the u64s field of a bkey was 0, that u64 was a
    noop and we'd start looking for the next bkey immediately after it.
    
    But extent handling has been lifted above the btree - we no longer
    modify existing extents in place in the btree, and the compatibilty code
    for old style extent btree nodes is gone, so we can completely drop this
    code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5c4be3c View commit details
    Browse the repository at this point in the history
  35. bcachefs: Generate better bkey formats when splitting nodes

    On btree node split, we weren't ensuring the min_key of the new larger
    node packs in the new format for this node. This triggers some painful
    slowpaths in the bset.c aux search tree code - this patch fixes that by
    calculating a new format for the new node with the new min_key.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1b1a9f1 View commit details
    Browse the repository at this point in the history
  36. bcachefs: Fix building of aux search trees

    We weren't packing the min/max keys, which was a major oversight and
    completely disabled generating bkey_floats for adjacent nodes.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ca6b048 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    b631cfe View commit details
    Browse the repository at this point in the history
  38. bcachefs: Fix for bch2_trans_commit() unlocking when it's not suppose…

    …d to
    
    When we pass BTREE_INSERT_NOUNLOCK bch2_trans_commit isn't supposed to
    unlock after a successful commit, but it was calling
    bch2_trans_cond_resched() - oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5d93ffc View commit details
    Browse the repository at this point in the history
  39. bcachefs: Simplify btree_node_iter_init_pack_failed()

    Since we now make sure to always generate packed bkey formats that can
    pack the min_key of a btree node, this path should actually never
    happen.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    70db49e View commit details
    Browse the repository at this point in the history
  40. bcachefs: btree key cache locking improvements

    The btree key cache mutex was becoming a significant bottleneck - it was
    mainly used to protect the lists of dirty, clean and freed cached keys.
    
    This patch eliminates the dirty and clean lists - instead, when we need
    to scan for keys to drop from the cache we iterate over the rhashtable,
    and thus we're able to remove most uses of that lock.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d2bd223 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    d4093fe View commit details
    Browse the repository at this point in the history
  42. bcachefs: Split out bpos_cmp() and bkey_cmp()

    With snapshots, we're going to need to differentiate between comparisons
    that should and shouldn't include the snapshot field. bpos_cmp is now
    the comparison function that does include the snapshot field, used by
    core btree code.
    
    Upper level filesystem code generally does _not_ want to compare against
    the snapshot field - that code wants keys to compare as equal even when
    one of them is in an ancestor snapshot.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7fcd041 View commit details
    Browse the repository at this point in the history
  43. bcachefs: Start using bpos.snapshot field

    This patch starts treating the bpos.snapshot field like part of the key
    in the btree code:
    
    * bpos_successor() and bpos_predecessor() now include the snapshot field
    * Keys in btrees that will be using snapshots (extents, inodes, dirents
      and xattrs) now always have their snapshot field set to U32_MAX
    
    The btree iterator code gets a new flag, BTREE_ITER_ALL_SNAPSHOTS, that
    determines whether we're iterating over keys in all snapshots or not -
    internally, this controlls whether bkey_(successor|predecessor)
    increment/decrement the snapshot field, or only the higher bits of the
    key.
    
    We add a new member to struct btree_iter, iter->snapshot: when
    BTREE_ITER_ALL_SNAPSHOTS is not set, iter->pos.snapshot should always
    equal iter->snapshot, which will be 0 for btrees that don't use
    snapshots, and alsways U32_MAX for btrees that will use snapshots
    (until we enable snapshot creation).
    
    This patch also introduces a new metadata version number, and compat
    code for reading from/writing to older versions - this isn't a forced
    upgrade (yet).
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    59f91dc View commit details
    Browse the repository at this point in the history
  44. bcachefs: Inode backpointers

    This patch adds two new inode fields, bi_dir and bi_dir_offset, that
    point back to the inode's dirent.
    
    Since we're only adding fields for a single backpointer, files that have
    been hardlinked won't necessarily have valid backpointers: we also add a
    new inode flag, BCH_INODE_BACKPTR_UNTRUSTED, that's set if an inode has
    ever had multiple links to it. That's ok, because we only really need
    this functionality for directories, which can never have multiple
    hardlinks - when we add subvolumes, we'll need a way to enemurate and
    print subvolumes, and this will let us reconstruct a path to a subvolume
    root given a subvolume root inode.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dce08b8 View commit details
    Browse the repository at this point in the history
  45. bcachefs: Change inode allocation code for snapshots

    For snapshots, when we allocate a new inode we want to allocate an inode
    number that isn't in use in any other subvolume. We won't be able to use
    ITER_SLOTS for this, inode allocation needs to change to use
    BTREE_ITER_ALL_SNAPSHOTS.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    72b4e47 View commit details
    Browse the repository at this point in the history
  46. bcachefs: Don't use bch2_inode_find_by_inum() in move.c

    Since move.c isn't aware of what subvolume we're in, we can't use the
    standard inode lookup code - fortunately, we're just using it for
    reading IO options.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e4330d5 View commit details
    Browse the repository at this point in the history
  47. bcachefs: Have journal reclaim thread flush more aggressively

    This adds a new watermark for the journal reclaim when flushing btree
    key cache entries - it should try and stay ahead of where foreground
    threads doing transaction commits will enter direct journal reclaim.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    249e369 View commit details
    Browse the repository at this point in the history
  48. bcachefs: Free iterator in bch2_btree_delete_range_trans()

    This is specifically to speed up bch2_inode_rm(), so that we're not
    traversing iterators we're done with.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9d0c78d View commit details
    Browse the repository at this point in the history
  49. bcachefs: Add repair code for out of order keys in a btree node.

    This just drops the offending key - in the bug report where this was
    seen, it was clearly a single bit memory error, and fsck will fix the
    missing key.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8cf350e View commit details
    Browse the repository at this point in the history
  50. bcachefs: Don't use write side of mark_lock in journal write path

    The write side of percpu rwsemaphors is really expensive, and we
    shouldn't be taking it at all in steady state operation.
    
    Fortunately, in bch2_journal_super_entries_add_common(), we don't need
    to - we have a seqlock, usage_lock for accumulating percpu usage
    counters to the base counters.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    35bdc29 View commit details
    Browse the repository at this point in the history
  51. bcachefs: Don't make foreground writes wait behind journal reclaim to…

    …o long
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dbd952e View commit details
    Browse the repository at this point in the history
  52. bcachefs: Move btree lock debugging to slowpath fn

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b793e49 View commit details
    Browse the repository at this point in the history
  53. bcachefs: Improve bch2_trans_relock()

    We're getting away from relying on iter->uptodate - this changes
    bch2_trans_relock() to more directly specify which iterators should be
    relocked.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    bd3556d View commit details
    Browse the repository at this point in the history
  54. bcachefs: Add a sysfs var for average btree write size

    Useful number for performance tuning.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    adef29a View commit details
    Browse the repository at this point in the history
  55. bcachefs: Improve bch2_btree_update_start()

    bch2_btree_update_start() is now responsible for taking gc_lock and
    upgrading the iterator to lock parent nodes - greatly simplifying error
    handling and all of the callers.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ab12eab View commit details
    Browse the repository at this point in the history
  56. bcachefs: Change where merging of interior btree nodes is trigger from

    Previously, we were doing btree node merging from
    bch2_btree_insert_node() - but this is called from the split path, when
    we're in the middle of creating new nodes and deleting new nodes and the
    iterators are in a weird state.
    
    Also, this means we're starting a new btree_update while in the middle
    of an existing one, and that's asking for deadlocks.
    
    Much simpler and saner to trigger btree node merging _after_ the whole
    btree node split path is finished.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7fced03 View commit details
    Browse the repository at this point in the history
  57. bcachefs: Kill bch2_btree_node_get_sibling()

    This patch reworks the btree node merge path to use a second btree
    iterator to get the sibling node - which means
    bch2_btree_iter_get_sibling() can be deleted. Also, it uses
    bch2_btree_iter_traverse_all() if necessary - which means it should be
    more reliable. We don't currently even try to make it work when
    trans->nounlock is set - after a BTREE_INSERT_NOUNLOCK transaction
    commit, hopefully this will be a worthwhile tradeoff.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a3eaa04 View commit details
    Browse the repository at this point in the history
  58. bcachefs: bch2_foreground_maybe_merge() now correctly reports lock re…

    …starts
    
    This means that btree node splits don't have to automatically trigger a
    transaction restart.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d123592 View commit details
    Browse the repository at this point in the history
  59. bcachefs: Move btree node merging to before transaction commit

    Currently, BTREE_INSERT_NOUNLOCK makes it hard to ensure btree node
    merging happens reliably - since btree node merging happens after
    transaction commit, we can't drop btree locks and block when starting
    the btree update.
    
    This patch moves it to before transaction commit - and failure to do a
    merge that we wanted to do just restarts the transaction.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d07cd98 View commit details
    Browse the repository at this point in the history
  60. bcachefs: Drop trans->nounlock

    Since we're no longer doing btree node merging post commit, we can now
    delete a bunch of code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b7d0089 View commit details
    Browse the repository at this point in the history
  61. bcachefs: Fix BTREE_FOREGROUND_MERGE_HYSTERESIS

    We were multiplying instead of dividing - oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a8e31da View commit details
    Browse the repository at this point in the history
  62. bcachefs: Increase commality between BTREE_ITER_NODES and BTREE_ITER_…

    …KEYS
    
    Eventually BTREE_ITER_NODES should be going away. This patch is to fix a
    transaction iterator overflow in the btree node merge path because
    BTREE_ITER_NODES iterators couldn't be reused.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    73f5bec View commit details
    Browse the repository at this point in the history
  63. bcachefs: Fix this_cpu_ptr() usage

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    fabc03e View commit details
    Browse the repository at this point in the history
  64. bcachefs: Fix journal deadlock

    After we get a journal reservation, we need to use it - if we erorr out
    of a transaction commit, we'll be eating into space in the journal and
    if our transaction needs to make forward progress in order to reclaim
    space in the journal, we'll deadlock.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5eab6d0 View commit details
    Browse the repository at this point in the history
  65. bcachefs: Be more careful about JOURNAL_RES_GET_RESERVED

    JOURNAL_RES_GET_RESERVED should only be used for updatse that need to be
    done to free up space in the journal. In particular, when we're flushing
    keys from the key cache, if we're flushing them out of order we
    shouldn't be using it, since we're using up our remaining space in the
    journal without dropping a pin that will let us make forward progress.
    
    With this patch, BTREE_INSERT_JOURNAL_RECLAIM without
    BTREE_INSERT_JOURNAL_RESERVED may return -EAGAIN - we can't wait on
    journal reclaim if we're already in journal reclaim.
    
    This means we need to propagate these errors up to journal reclaim,
    indicating that flushing a journal pin should be retried in the future.
    
    This is prep work for a patch to change the way journal reclaim works,
    to split out flushing key cache keys because the btree key cache is too
    dirty from journal reclaim because we need space in the journal.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dba55ed View commit details
    Browse the repository at this point in the history
  66. bcachefs: Fix livelock calling bch2_mark_bkey_replicas()

    The bug was that we were trying to find a replicas entry that wasn't
    sorted - but, we can also simplify the code by not using
    bch2_mark_bkey_replicas and instead ensuring the list of replicas
    entries exists directly.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    30702f5 View commit details
    Browse the repository at this point in the history
  67. bcachefs: Kill bch2_fs_usage_scratch_get()

    This is an important cleanup, eliminating an unnecessary copy in the
    transaction commit path.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4943edb View commit details
    Browse the repository at this point in the history
  68. bcachefs: Drop some memset() calls

    gcc is emitting rep stos here, which is silly (and slow) for an 8 byte
    memset.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    286fc36 View commit details
    Browse the repository at this point in the history
  69. bcachefs: Eliminate memory barrier from fast path of journal_preres_p…

    …ut()
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1e770a8 View commit details
    Browse the repository at this point in the history
  70. bcachefs: kill bset_tree->max_key

    Since we now ensure a btree node's max key fits in its packed format,
    this isn't needed for the reasons it used to be - and, it was being used
    inconsistently.
    
    Also reorder struct btree a bit for performance, and kill some dead
    code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2727dfd View commit details
    Browse the repository at this point in the history
  71. bcachefs: Fix an uninitialized variable

    Fortunately it was just used in an error message
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    deb4a39 View commit details
    Browse the repository at this point in the history
  72. bcachefs: Fix a startup race

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    90d466b View commit details
    Browse the repository at this point in the history
  73. bcachefs: Increase BSET_CACHELINE to 256 bytes

    Linear searches have gotten cheaper relative to binary searches on
    modern hardware, due to better branch prediction behaviour.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e25900e View commit details
    Browse the repository at this point in the history
  74. bcachefs: Eliminate more PAGE_SIZE uses

    In userspace, we don't really have a well defined PAGE_SIZE and shouln't
    be relying on it. This is some more incremental work to remove
    references to it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    36c5c04 View commit details
    Browse the repository at this point in the history
  75. bcachefs: Don't flush btree writes more aggressively because of btree…

    … key cache
    
    We need to flush the btree key cache when it's too dirty, because
    otherwise the shrinker won't be able to reclaim memory - this is done by
    journal reclaim. But journal reclaim also kicks btree node writes: this
    meant that btree node writes were getting kicked much too often just
    because we needed to flush btree key cache keys.
    
    This patch splits journal pins into two different lists, and teaches
    journal reclaim to not flush btree node writes when it only needs to
    flush key cache keys.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4057252 View commit details
    Browse the repository at this point in the history
  76. bcachefs: Improve bset compaction

    The previous patch that fixed btree nodes being written too aggressively
    now meant that we weren't sorting btree node bsets optimally - this
    patch fixes that.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d52ce23 View commit details
    Browse the repository at this point in the history
  77. bcachefs: Move some dirent checks to bch2_dirent_invalid()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7fec8d1 View commit details
    Browse the repository at this point in the history
  78. bcachefs: Drop bch2_fsck_inode_nlink()

    We've had BCH_FEATURE_atomic_nlink for quite some time, we can drop this
    now.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5376e51 View commit details
    Browse the repository at this point in the history
  79. bcachefs: Don't wait for ALLOC_SCAN_BATCH buckets in allocator

    It used to be necessary for the allocator thread to batch up
    invalidating buckets when possible - but since we added the btree key
    cache that hasn't been a concern, and now it's causing the allocator
    thread to livelock when the filesystem is nearly full.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    35d81ef View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    b9d4589 View commit details
    Browse the repository at this point in the history
  81. bcachefs: Fix bch2_gc_btree_gens()

    Since we're using a NOT_EXTENTS iterator, we shouldn't be setting the
    iter pos to the start of the extent.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    01f1ade View commit details
    Browse the repository at this point in the history
  82. bcachefs: Fix BTREE_ITER_NOT_EXTENTS

    bch2_btree_iter_peek() wasn't properly checking for
    BTREE_ITER_IS_EXTENTS when updating iter->pos.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b733225 View commit details
    Browse the repository at this point in the history
  83. bcachefs: Check inodes at start of fsck

    This splits out checking inode nlinks from the rest of the inode checks
    and moves most of the inode checks to the start of fsck, so that other
    fsck passes can depend on it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4c64e2b View commit details
    Browse the repository at this point in the history
  84. bcachefs: Simplify hash table checks

    Very early on there was a period where we were accidentally generating
    dirents with trailing garbage; we've since dropped support for
    filesystems that old and the fsck code can be dropped.
    
    Also, this patch switches to a simpler algorithm for checking hash
    tables. It's less efficient on hash collision - but with 64 bit keys,
    those are very rare.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6057971 View commit details
    Browse the repository at this point in the history
  85. bcachefs: Inode backpointers are now required

    This lets us simplify fsck quite a bit, which we need for making fsck
    snapshot aware.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0e23fa0 View commit details
    Browse the repository at this point in the history
  86. bcachefs: Redo check_nlink fsck pass

    Now that we have inode backpointers the check_nlink pass only is
    concerned with files that have hardlinks, and can be simplified.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d5b43e4 View commit details
    Browse the repository at this point in the history
  87. bcachefs: Fix bch2_trans_relock()

    The patch that changed bch2_trans_relock() to not look at iter->uptodate
    also tried to add an optimization by only having it relock
    btree_iter_key() iterators (iterators that are live or have been marked
    as keep). But, this wasn't thought through - this pops internal iterator
    assertions because on transaction restart, when we're traversing
    iterators we traverse all iterators marked as linked, and having
    bch2_trans_relock() skip some of those mean that it can skil the
    iterator that bch2_btree_iter_traverse_one() is currently traversing.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    39707d0 View commit details
    Browse the repository at this point in the history
  88. bcachefs: Fix fsck to not use bch2_link_trans()

    bch2_link_trans() uses the btree key cache for inode updates, and fsck
    isn't supposed to - also, it's not really what we want for reattaching
    unreachable inodes anyways.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d4bd08f View commit details
    Browse the repository at this point in the history
  89. bcachefs: Improved check_directory_structure()

    Now that we have inode backpointers, we can simplify checking directory
    structure: instead of doing a DFS from the filesystem root and then
    checking if we found everything, we can iterate over every inode and see
    if we can go up until we get to the root.
    
    This patch also has a number of fixes and simplifications for the inode
    backpointer checks. Also, it turns out we don't actually need the
    BCH_INODE_BACKPTR_UNTRUSTED flag.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6c6afe5 View commit details
    Browse the repository at this point in the history
  90. bcachefs: BCH_BEATURE_atomic_nlink is obsolete

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    347af01 View commit details
    Browse the repository at this point in the history
  91. bcachefs: Fix heap overrun in bch2_fs_usage_read()

    oops
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0c46dbc View commit details
    Browse the repository at this point in the history
  92. bcachefs: Add the status of bucket gen gc to sysfs

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    477d145 View commit details
    Browse the repository at this point in the history
  93. bcachefs: Ensure bucket gen gc completes

    We don't want it to block, if it can't allocate it should just continue
    instead of possibly deadlocking.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    3ccd45e View commit details
    Browse the repository at this point in the history
  94. bcachefs: Add a perf test for multiple updates per commit

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    41ca62f View commit details
    Browse the repository at this point in the history
  95. bcachefs: Drop old style btree node coalescing

    We have foreground btree node merging now, and any future btree node
    merging improvements are going to be based off of that code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    41dc38a View commit details
    Browse the repository at this point in the history
  96. bcachefs: Better iterator picking

    Avoid cloning iterators if we don't have to.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e455701 View commit details
    Browse the repository at this point in the history
  97. bcachefs: Don't call bch2_btree_iter_traverse() unnecessarily

    If we let bch2_trans_commit() do it, it'll traverse iterators in sorted
    order which means we'll get fewer lock restarts.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5faab1e View commit details
    Browse the repository at this point in the history
  98. bcachefs: Fix bch2_gc_done() error messages

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    c27e507 View commit details
    Browse the repository at this point in the history
  99. bcachefs: Fix journal_reclaim_wait_done()

    Can't run arbitrary code inside a wait_event() conditional, due to
    task state being weird...
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b96cc2a View commit details
    Browse the repository at this point in the history
  100. bcachefs: Improve bch2_btree_iter_traverse_all()

    By changing it to upgrade iterators to intent locks to avoid lock
    restarts we can simplify __bch2_btree_node_lock() quite a bit - this
    fixes a probable bug where it could potentially drop a lock on an
    unrelated error but still succeed instead of causing a transaction
    restart.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    c757af5 View commit details
    Browse the repository at this point in the history
  101. bcachefs: Don't downgrade iterators in bch2_trans_get_iter()

    This fixes a livelock with btree node splits.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7a5f402 View commit details
    Browse the repository at this point in the history
  102. bcachefs: Improve trans_restart_mem_realloced tracepoint

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6fa9de4 View commit details
    Browse the repository at this point in the history
  103. bcachefs: Fix bch2_trans_mark_dev_sb()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    26b30ff View commit details
    Browse the repository at this point in the history
  104. bcachefs: Simplify bch2_set_nr_journal_buckets()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8ac7aa6 View commit details
    Browse the repository at this point in the history
  105. bcachefs: Fix an RCU splat

    Writepoints are never deallocated so the rcu_read_lock() isn't really
    needed, but we are doing lockless list traversal.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9db1d69 View commit details
    Browse the repository at this point in the history
  106. bcachefs: Fix journal reclaim loop

    When dirty key cache keys were separated from other journal pins, we
    broke the loop conditional in __bch2_journal_reclaim() - it's supposed
    to keep looping as long as there's work to do.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4825894 View commit details
    Browse the repository at this point in the history
  107. bcachefs: Fix transaction restarts due to upgrading of cloned iterators

    This fixes a regression from
      52d86202fd bcachefs: Improve bch2_btree_iter_traverse_all()
    
    We want to avoid mucking with other iterators in the btree transaction
    in operations that are only supposed to be touching individual iterators
    - that patch was a cleanup to move lock ordering handling to
    bch2_btree_iter_traverse_all(). But it broke upgrading of cloned
    iterators.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    07f4cd4 View commit details
    Browse the repository at this point in the history
  108. bcachefs: Simplify fsck remove_dirent()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    916e58e View commit details
    Browse the repository at this point in the history
  109. bcachefs: Fix some small memory leaks

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0c8095a View commit details
    Browse the repository at this point in the history
  110. bcachefs: Fix an unused var warning in userspace

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    57ed8d4 View commit details
    Browse the repository at this point in the history
  111. bcachefs: Refactor bchfs_fallocate() to not nest btree_trans on stack

    Upcoming patch is going to disallow multiple btree_trans on the stack.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    10efd18 View commit details
    Browse the repository at this point in the history
  112. bcachefs: gc shouldn't care about owned_by_allocator

    The owned_by_allocator field is a purely in memory thing, even if/when
    we bring back GC at runtime there's no need for it to be recalculating
    this field. This is prep work for pulling it out of struct bucket, and
    eventually getting rid of the bucket array.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    313de79 View commit details
    Browse the repository at this point in the history
  113. bcachefs: Allocator thread doesn't need gc_lock anymore

    Even with runtime gc (which currently isn't supported), runtime gc no
    longer clears/recalculates the main set of bucket marks - it allocates
    and calculates another set, updating the primary at the end.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    060014b View commit details
    Browse the repository at this point in the history
  114. bcachefs: Handle errors in bch2_trans_mark_update()

    It's not actually the case that iterators are always checked here -
    __bch2_trans_commit() checks for that after running triggers.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6bc7f61 View commit details
    Browse the repository at this point in the history
  115. bcachefs: Check that keys are in the correct btrees

    We've started seeing bug reports of pointers to btree nodes being
    detected in leaf nodes. This should catch that before it's happened, and
    it's something we should've been checking anyways.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d38e9dc View commit details
    Browse the repository at this point in the history
  116. bcachefs: Always check for invalid bkeys in trans commit path

    We check for this prior to metadata being written, but we're seeing some
    strange bugs lately, and this will help catch those closer to where they
    occur.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8cd33be View commit details
    Browse the repository at this point in the history
  117. bcachefs: Allocator refactoring

    This uses the kthread_wait_freezable() macro to simplify a lot of the
    allocator thread code, along with cleaning up bch2_invalidate_bucket2().
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e3f7424 View commit details
    Browse the repository at this point in the history
  118. bcachefs: Preallocate trans mem in bch2_migrate_index_update()

    This will help avoid transaction restarts.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    158d369 View commit details
    Browse the repository at this point in the history
  119. bcachefs: Fix for btree_gc repairing interior btree ptrs

    Using the normal transaction commit path to insert and journal updates
    to interior nodes hadn't been done before this repair code was written,
    not surprising that there was a bug.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    69f0715 View commit details
    Browse the repository at this point in the history
  120. bcachefs: Fix a use after free

    Turns out, we weren't waiting on in flight btree writes when freeing
    existing btree nodes. This lead to stray btree writes overwriting newly
    allocated buckets, but only started showing itself with some of the
    recent allocator work and another patch to move submitting of btree
    writes to worqueues.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1e54da2 View commit details
    Browse the repository at this point in the history
  121. bcachefs: Punt btree writes to workqueue to submit

    We don't want to be submitting IO with btree locks held, and btree
    writes usually aren't latency sensitive.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    01a132c View commit details
    Browse the repository at this point in the history
  122. bcachefs: Fix two btree iterator leaks

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2ba9ed8 View commit details
    Browse the repository at this point in the history
  123. bcachefs: Update bch2_btree_verify()

    bch2_btree_verify() verifies that the btree node on disk matches what we
    have in memory. This patch changes it to verify every replica, and also
    fixes it for interior btree nodes - there's a mem_ptr field which is
    used as a scratch space and needs to be zeroed out for comparing with
    what's on disk.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0f8d9cc View commit details
    Browse the repository at this point in the history
  124. bcachefs: Fix a deadlock on journal reclaim

    Flushing the btree key cache needs to use allocation reserves - journal
    reclaim depends on flushing the btree key cache for making forward
    progress, and the allocator and copygc depend on journal reclaim making
    forward progress.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4d4c2d4 View commit details
    Browse the repository at this point in the history
  125. bcachefs: Don't BUG() in update_replicas

    Apparently, we have a bug where in mark and sweep while accounting for a
    key, a replicas entry isn't found. Change the code to print out the key
    we couldn't mark and halt instead of a BUG_ON().
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0f21481 View commit details
    Browse the repository at this point in the history
  126. bcachefs: Lookup/create lost+found lazily

    This is prep work for subvolumes - each subvolume will have its own
    lost+found.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4702d58 View commit details
    Browse the repository at this point in the history
  127. bcachefs: Fix repair leading to replicas not marked

    bch2_check_fix_ptrs() was being called after checking if the replicas
    set was marked - but repair could change which replicas set needed to be
    marked. Oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    168ef9a View commit details
    Browse the repository at this point in the history
  128. bcachefs: Don't BUG_ON() btree topology error

    This replaces an assertion in the btree merge path with a
    bch2_inconsistent_error() - fsck will fix it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dbfd061 View commit details
    Browse the repository at this point in the history
  129. bcachefs: Add a mempool for btree_trans bump allocator

    This allocation is required for filesystem operations to make forward
    progress, thus needs a mempool.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    cb8ce5d View commit details
    Browse the repository at this point in the history
  130. bcachefs: Add a mempool for the replicas delta list

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dcc5355 View commit details
    Browse the repository at this point in the history
  131. bcachefs: Use mmap() instead of vmalloc_exec() in userspace

    Calling mmap() directly is much better than malloc() then mprotect(), we
    end up with much less address space fragmentation.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9d43018 View commit details
    Browse the repository at this point in the history
  132. bcachefs: Fix an out of bounds read

    bch2_varint_decode() can read up to 7 bytes past the end of the buffer,
    which means we need to allocate slightly larger key cache buffers.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    c1a5b6a View commit details
    Browse the repository at this point in the history
  133. bcachefs: Fix bch2_verify_keylist_sorted

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6cf32da View commit details
    Browse the repository at this point in the history
  134. bcachefs: Rewrite btree nodes with errors

    This patch adds self healing functionality for btree nodes - if we
    notice a problem when reading a btree node, we just rewrite it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ea18900 View commit details
    Browse the repository at this point in the history
  135. bcachefs: New helper __bch2_btree_insert_keys_interior()

    Consolidate common parts of bch2_btree_insert_keys_interior() and
    btree_split_insert_keys() - prep work for adding some new topology
    assertions.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a4ba17b View commit details
    Browse the repository at this point in the history
  136. bcachefs: Fix key cache assertion

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    f75c5b4 View commit details
    Browse the repository at this point in the history
  137. bcachefs: New and improved topology repair code

    This splits out btree topology repair into a separate pass, and makes
    some improvements:
     - When we have to pick which of two overlapping nodes to drop keys
       from, we use the btree node header sequence number to preserve the
       newer node
    
     - the gc code has been changed so that it doesn't bail out if we're
       continuing/ignoring on fsck error - this way the dump tool can skip
       running the repair pass but still walk all reachable metadata
    
     - add a new superblock flag indicating when a filesystem is known to
       have btree topology issues, and the topology repair pass should be
       run
    
     - changing the start/end of a node might mean keys in that node have to
       be deleted: this patch handles that better by splitting it out into a
       separate function and running it explicitly in the topology repair
       code, previously those keys were only being dropped when the btree
       node was read in.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    52a4d56 View commit details
    Browse the repository at this point in the history
  138. bcachefs: Fix a null ptr deref

    Fix a few memory safety issues, found by asan in userspace.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    145bc3d View commit details
    Browse the repository at this point in the history
  139. bcachefs: New check_nlinks algorithm for snapshots

    With snapshots, using a radix tree for the table of link counts won't
    work anymore because we also need to distinguish between inodes with
    different snapshot IDs. Instead, this patch builds up a sorted array of
    inodes that have hardlinks that we can binary search on - taking
    advantage of the fact that with inode backpointers, the check_nlinks()
    pass _only_ needs to concern itself with inodes that have hardlinks now.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6500938 View commit details
    Browse the repository at this point in the history
  140. bcachefs: Evict btree nodes we're deleting

    There was a bug that led to duplicate btree node pointers being inserted
    at the wrong level. The new topology repair code can fix that, except
    that the btree cache code gets confused when we read in a btree node
    from the pointer that was at the wrong level. This patch evicts nodes
    that we're deleting to, which nicely solves the problem.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9e1839a View commit details
    Browse the repository at this point in the history
  141. bcachefs: Fix __bch2_trans_get_iter()

    We need to also set iter->uptodate to indicate it needs to be traversed.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1b39f7d View commit details
    Browse the repository at this point in the history
  142. bcachefs: New tracepoint for bch2_trans_get_iter()

    Trying to debug an issue where after traverse_all() we shouldn't have to
    traverse any iterators... yet we are
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    55fe3d4 View commit details
    Browse the repository at this point in the history
  143. bcachefs: Call bch2_inconsistent_error() on missing stripe/indirect e…

    …xtent
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e137126 View commit details
    Browse the repository at this point in the history
  144. bcachefs: Change bch2_btree_key_cache_count() to exclude dirty keys

    We're seeing livelocks that appear to be due to
    bch2_btree_key_cache_scan repeatedly scanning and blocking other tasks
    from using the key cache lock - we probably shouldn't be reporting
    objects that can't actually be freed yet.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b34ec71 View commit details
    Browse the repository at this point in the history
  145. bcachefs: Change copygc wait amount to be min of per device waits

    We're seeing a filesystem get stuck when all devices but one have no
    more reclaimable buckets - because the copygc wait amount is curretly
    filesystem wide.
    
    This patch should fix that, possibly at the expensive of running too
    much when only one or a few devices is full and the rebalance thread
    needs to move data around.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7b08c8b View commit details
    Browse the repository at this point in the history
  146. bcachefs: Enable .splice_write

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    3c22d04 View commit details
    Browse the repository at this point in the history
  147. bcachefs: Ensure that fpunch updates inode timestamps

    Fixes xfstests generic/059
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    31bbad5 View commit details
    Browse the repository at this point in the history
  148. bcachefs: Make sure to initialize j->last_flushed

    If the journal reclaim thread makes it to the timeout without ever
    initializing j->last_flushed, we could end up sleeping for a very long
    time.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e29207a View commit details
    Browse the repository at this point in the history
  149. bcachefs: Add a tracepoint for when we block on journal reclaim

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1766ac8 View commit details
    Browse the repository at this point in the history
  150. bcachefs: Fix time handling

    There were some overflows in the time conversion functions - fix this by
    converting tv_sec and tv_nsec separately. Also, set sb->time_min and
    sb->time_max.
    
    Fixes xfstest generic/258.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    cffbbe7 View commit details
    Browse the repository at this point in the history
  151. bcachefs: Mark newly allocated btree nodes as accessed

    This was a major oversight - this means under memory pressure we can end
    up reading in a btree node, then having it evicted before we get to use
    it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    1b2a38b View commit details
    Browse the repository at this point in the history
  152. bcachefs: Clean up bch2_btree_and_journal_walk()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9b5ed4f View commit details
    Browse the repository at this point in the history
  153. bcachefs: Fix usage of last_seq + encryption

    jset->last_seq is in the region that's encrypted - on journal write
    completion, we were using it and getting garbage. This patch shadows it
    to fix.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    45f2043 View commit details
    Browse the repository at this point in the history
  154. bcachefs: Fix oob write in __bch2_btree_node_write

    Fix a possible out of bounds write in __bch2_btree_node_write when
    the data buffer padding is cleared up to the block size. The out of
    bounds write is possible if the data buffers size is not a multiple
    of the block size.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b8b5ae0 View commit details
    Browse the repository at this point in the history
  155. bcachefs: Fix some refcounting bugs

    We really need debug mode assertions that ca->ref and ca->io_ref are
    used correctly.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    733f2e9 View commit details
    Browse the repository at this point in the history
  156. bcachefs: Fix reflink trigger

    The trigger for reflink pointers wasn't always incrementing/decrementing
    the refcounts correctly - this patch fixes that logic.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e478e21 View commit details
    Browse the repository at this point in the history
  157. bcachefs: Fix bch2_btree_iter_peek_with_updates()

    By not re-fetching the next update we were going into an infinite loop.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7083c94 View commit details
    Browse the repository at this point in the history
  158. bcachefs: Make sure to use BTREE_ITER_PREFETCH in fsck

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    d7808dd View commit details
    Browse the repository at this point in the history
  159. bcachefs: avoid out-of-bounds in split_devs

    Calling mount with an empty source string causes an out-of-bounds error
    in split_devs. Check the length of the source string to avoid this.
    
    Signed-off-by: Stijn Tintel <[email protected]>
    stintel authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9ee502c View commit details
    Browse the repository at this point in the history
  160. bcachefs: Fix error in parsing of mount options

    When parsing the mount options duplicate the given options. This is
    required as the options are parsed twice and strsep is used in parsing.
    The options will be modified into a possibly invalid options set for the
    second round of parsing if the options are not duplicated before
    parsing.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2a0d803 View commit details
    Browse the repository at this point in the history
  161. bcachefs: Fix possible null deref on mount

    Ensure that the block device pointer in a superblock handle is not
    null before dereferencing it in bch2_dev_to_fs. The block device pointer
    may be null when mounting a new bcachefs filesystem given another mounted
    bcachefs filesystem exists that has at least one device that is offline.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8f02ea1 View commit details
    Browse the repository at this point in the history
  162. bcachefs: Fix null deref in bch2_ioctl_read_super

    Do not attempt to cleanup the returned value of bch2_device_lookup if
    the returned value was an error pointer. We currently check to see if
    the returned value is null and run the cleanup otherwise. As a result,
    we attempt to run the cleanup on a error pointer.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    4c7ae97 View commit details
    Browse the repository at this point in the history
  163. bcachefs: Fix out of bounds read in fs usage ioctl

    Fix a possible read out of bounds if bch2_ioctl_fs_usage is called when
    replica_entries_bytes is set to a value that is smaller than the size
    of bch_replicas_usage.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    c7e8d12 View commit details
    Browse the repository at this point in the history
  164. bcachefs: Repair code for multiple types of data in same bucket

    bch2_check_fix_ptrs() is awkward, we need to find a way to improve it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    edbffcf View commit details
    Browse the repository at this point in the history
  165. bcachefs: properly initialize used values

     - Ensure the second key value in bch_hash_info is initialized to zero
       if the info type is of type BCH_STR_HASH_SIPHASH.
    
     - Initialize the possibly returned value in bch2_inode_create. Assuming
       bch2_btree_iter_peek returns bkey_s_c_null, the uninitialized value
       of ret could be returned to the user as an error pointer.
    
     - Fix compiler warning in initialization of bkey_s_c_stripe
    
    fs/bcachefs/buckets.c:1646:35: warning: suggest braces around initialization
    of subobject [-Wmissing-braces]
            struct bkey_s_c_stripe new_s = { NULL };
                                             ^~~~
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    64a2827 View commit details
    Browse the repository at this point in the history
  166. bcachefs: Fix locking in __bch2_set_nr_journal_buckets()

    We weren't holding mark_lock correctly - it's needed for the new_fs
    path.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    13b2b40 View commit details
    Browse the repository at this point in the history
  167. bcachefs: made changes to support clang, fixed a couple bugs

    fs/bcachefs/bset.c              edited prefetch macro to add clang support
    fs/bcachefs/btree_iter.c        bugfix: initialize iter->real_pos in bch2_btree_iter_init for later use
    fs/bcachefs/io.c                bugfix: eliminated undefined behavior (negative bitshift)
    fs/bcachefs/buckets.c           bugfix: invert sign to handle 64bit abs()
    holmanb authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b2a642a View commit details
    Browse the repository at this point in the history
  168. bcachefs: Make sure to pass a disk reservation to bch2_extent_update()

    It's needed when we split an existing compressed extent - we get a null
    ptr deref without it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    996f94c View commit details
    Browse the repository at this point in the history
  169. bcachefs: Fix bch2_extent_can_insert() call

    It was being skipped when hole punching, leading to problems when
    splitting compressed extents.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6f96270 View commit details
    Browse the repository at this point in the history
  170. bcachefs: Fix a memcpy call

    Not supposed to pass a null ptr to memcpy (even if the size is 0).
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8b95065 View commit details
    Browse the repository at this point in the history
  171. bcachefs: Fix for bch2_bkey_pack_pos() not initializing len/version f…

    …ields
    
    This bug led to push_whiteout() generating whiteouts that failed
    bch2_bkey_invalid() due to nonzero length fields - oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    007fef9 View commit details
    Browse the repository at this point in the history
  172. bcachefs: statfs resports incorrect avail blocks

    The current implementation of bch_statfs does not scale the number of
    available blocks provided in f_bavail by the reserve factor. This causes
    an allocation of a file of this size to fail.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7e54fc8 View commit details
    Browse the repository at this point in the history
  173. bcachefs: Move io_in_flight ratelimiting to fs-io.c

    This fixes a bug where an async O_DIRECT write that required multiple
    bch2_write calls could deadlock, because bch2_write runs out of the same
    workqueue used for index updates and would block on the io_in_flight
    semaphore.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9ff85d2 View commit details
    Browse the repository at this point in the history
  174. bcachefs: Split extents if necessary in bch2_trans_update()

    Currently, we handle multiple overlapping extents in the same
    transaction commit by doing fixups in bch2_trans_update() - this patch
    extents that to split updates when necessary. The next patch that
    changes the reflink code to not fragment extents when making them
    indirect will require this.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    821cc23 View commit details
    Browse the repository at this point in the history
  175. bcachefs: Make bch2_remap_range respect O_SYNC

    Caught by xfstest generic/628
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    7439d73 View commit details
    Browse the repository at this point in the history
  176. bcachefs: Fix inode backpointers in RENAME_OVERWRITE

    When we delete the dirent an inode points to, we need to zero out the
    backpointer fields - this was missed in the RENAME_OVERWRITE case.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    69fff7b View commit details
    Browse the repository at this point in the history
  177. bcachefs: Fix for buffered writes getting -ENOSPC

    Buffered writes may have to increase their disk reservation at btree
    update time, due to compression and erasure coding being unpredictable:
    O_DIRECT writes should be checking for -ENOSPC, but buffered writes have
    already been accepted and should not.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    60bbb53 View commit details
    Browse the repository at this point in the history
  178. bcachefs: Fix an uninitialized var

    this fixes a valgrind complaint
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5190b9f View commit details
    Browse the repository at this point in the history
  179. bcachefs: Don't repair btree nodes until after interior journal repla…

    …y is done
    
    We need the btree to be in a consistent state before we can rewrite
    btree nodes.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ad96f40 View commit details
    Browse the repository at this point in the history
  180. bcachefs: Add a debug mode that always reads from every btree replica

    There's a new module parameter, verify_all_btree_replicas, that enables
    reading from every btree replica when reading in btree nodes and
    comparing them against each other. We've been seeing some strange btree
    corruption - this will hopefully aid in tracking it down and catching it
    more often.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    c52d87d View commit details
    Browse the repository at this point in the history
  181. Configuration menu
    Copy the full SHA
    befc457 View commit details
    Browse the repository at this point in the history
  182. bcachefs: Add a workqueue for btree io completions

    Also, clean up workqueue usage - we shouldn't be using system
    workqueues, pretty much everything we do needs to be on our own
    WQ_MEM_RECLAIM workqueues.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    395fc34 View commit details
    Browse the repository at this point in the history
  183. bcachefs: Improve FS_IOC_GOINGDOWN ioctl

    We weren't interpreting the flags argument at all.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ed68469 View commit details
    Browse the repository at this point in the history
  184. bcachefs: Fix an issue with inconsistent btree writes after unclean s…

    …hutdown
    
    After unclean shutdown, btree writes may have completed on one device
    and not others - and this inconsistency could lead us to writing new
    bsets with a gap in our btree node in one of our replicas.
    
    Fortunately, this is only an issue with bsets that are newer than the
    most recent journal flush, and we already have a mechanism for detecting
    and blacklisting those. We just need to make sure to start new btree
    writes after the most recent _non_ blacklisted bset.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a97786d View commit details
    Browse the repository at this point in the history
  185. bcachefs: Fix a null ptr deref

    bch2_btree_iter_peek() won't always return a key - whoops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    bae26d0 View commit details
    Browse the repository at this point in the history
  186. bcachefs: Add a cond_resched call to the copygc main loop

    We seem to have a bug where the copygc thread ends up spinning and
    making the system unusable - this will at least prevent it from locking
    up the machine, and it's a good thing to have anyways.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    3ee65ca View commit details
    Browse the repository at this point in the history
  187. bcachefs: Add a tracepoint for copygc waiting

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    863a13a View commit details
    Browse the repository at this point in the history
  188. bcachefs: Don't use uuid in tracepoints

    %pU for printing out pointers to uuids doesn't work in perf trace
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    5d7af0d View commit details
    Browse the repository at this point in the history
  189. bcachefs: Add an option to control sharding new inode numbers

    We're seeing a bug where inode creates end up spinning in
    bch2_inode_create - disabling sharding will simplify what we're testing.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    3d30afa View commit details
    Browse the repository at this point in the history
  190. bcachefs: Reflink refcount fix

    __bch2_trans_mark_reflink_p wasn't always correctly returning the number
    of sectors processed - the new logic is a bit more straightforward
    overall too.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0a33d62 View commit details
    Browse the repository at this point in the history
  191. bcachefs: Fix journal write error path

    Journal write errors were racing with the submission path - potentially
    causing writes to other replicas to not get submitted.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e2085a3 View commit details
    Browse the repository at this point in the history
  192. bcachefs: Fix pathalogical behaviour with inode sharding by cpu ID

    If the transactior restarts on a different CPU, it could end up needing
    to read in a different btree node, which makes another transaction
    restart more likely...
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    ae8b7c9 View commit details
    Browse the repository at this point in the history
  193. bcachefs: Split out btree_error_wq

    We can't use btree_update_wq becuase btree updates may be waiting on
    btree writes to complete.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    de0c6e3 View commit details
    Browse the repository at this point in the history
  194. bcachefs: Fix a deadlock

    Waiting on a btree node write with btree locks held can deadlock, if the
    write errors: the write error path has to do do a btree update to drop
    the pointer to the replica that errored.
    
    The interior update path has to wait on in flight btree writes before
    freeing nodes on disk. Previously, this was done in
    bch2_btree_interior_update_will_free_node(), and could deadlock; now, we
    just stash a pointer to the node and do it in
    btree_update_nodes_written(), just prior to the transactional part of
    the update.
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    6435a72 View commit details
    Browse the repository at this point in the history
  195. bcachefs: Assorted endianness fixes

    Found by sparse
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    8d273c8 View commit details
    Browse the repository at this point in the history
  196. bcachefs: Fsck for reflink refcounts

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    0c6d9ae View commit details
    Browse the repository at this point in the history
  197. bcachefs: Don't fragment extents when making them indirect

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    dc021d9 View commit details
    Browse the repository at this point in the history
  198. bcachefs: Journal space calculation fix

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    b9d973d View commit details
    Browse the repository at this point in the history
  199. bcachefs; Check for allocator thread shutdown

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    9e3db6f View commit details
    Browse the repository at this point in the history
  200. bcachefs: Check for errors from bch2_trans_update()

    Upcoming refactoring is going to change bch2_trans_update() to start
    returning transaction restarts.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    810c3ce View commit details
    Browse the repository at this point in the history
  201. bcachefs: Preallocate transaction mem

    This helps avoid transaction restarts.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    a0750e0 View commit details
    Browse the repository at this point in the history
  202. bcachefs: Improve btree iterator tracepoints

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    eddf0c7 View commit details
    Browse the repository at this point in the history
  203. bcachefs: btree_iter->should_be_locked

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    fb80180 View commit details
    Browse the repository at this point in the history
  204. bcachefs: do not compile acl mod on minimal config

    Do not compile the acl.o target if BCACHEFS_POSIX_ACL is not enabled.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    2ce5d8e View commit details
    Browse the repository at this point in the history
  205. Configuration menu
    Copy the full SHA
    8069a2f View commit details
    Browse the repository at this point in the history
  206. bcachefs: Fix a spurious debug mode assertion

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    86c48b6 View commit details
    Browse the repository at this point in the history
  207. bcachefs: Don't mark superblocks past end of usable space

    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 <[email protected]>
    koverstreet committed Jun 9, 2021
    Configuration menu
    Copy the full SHA
    e6acff9 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2021

  1. bcachefs: Fix a buffer overrun

    In make_extent_indirect(), we were allocating too small of a buffer for
    the new indirect extent.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    cc5002f View commit details
    Browse the repository at this point in the history
  2. bcachefs: More topology repair code

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    9c79512 View commit details
    Browse the repository at this point in the history
  3. bcachefs: Drop all btree locks when submitting btree node reads

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    701b9bd View commit details
    Browse the repository at this point in the history
  4. bcachefs: Child btree iterators

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    f2309da View commit details
    Browse the repository at this point in the history
  5. bcachefs: BTREE_ITER_WITH_UPDATES

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    22dff78 View commit details
    Browse the repository at this point in the history
  6. bcachefs: Move extent_handle_overwrites() to bch2_trans_update()

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    f85b069 View commit details
    Browse the repository at this point in the history
  7. bcachefs: Simplify reflink trigger

    Now that we only mark entire extents, we can ditch the
    "reflink_p_frag_references" code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    4dd2810 View commit details
    Browse the repository at this point in the history
  8. bcachefs: Kill trans->updates2

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    14d6699 View commit details
    Browse the repository at this point in the history
  9. bcachefs: Clean up key merging

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    3ce082f View commit details
    Browse the repository at this point in the history
  10. bcachefs: Re-implement extent merging in transaction commit path

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    7f6e5ae View commit details
    Browse the repository at this point in the history
  11. bcachefs: Improved extent merging

    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 <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    3f1bf37 View commit details
    Browse the repository at this point in the history
  12. bcachefs: Merging for indirect extents

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    161ef31 View commit details
    Browse the repository at this point in the history
  13. bcachefs: Always zero memory from bch2_trans_kmalloc()

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    69be0da View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2021

  1. bcachefs: Fix overflow in journal_replay_entry_early

    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 <[email protected]>
    koverstreet committed Jun 11, 2021
    Configuration menu
    Copy the full SHA
    95fc50b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    484f2c4 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2021

  1. bcachefs: Fix null ptr deref when splitting compressed extents

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 12, 2021
    Configuration menu
    Copy the full SHA
    bbadb5e View commit details
    Browse the repository at this point in the history
  2. bcachefs: mount: fix null deref with null devname

     - 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 <[email protected]>
    dlrobertson authored and koverstreet committed Jun 12, 2021
    Configuration menu
    Copy the full SHA
    78779c3 View commit details
    Browse the repository at this point in the history
  3. bcachefs: Allow shorter JSET_ENTRY_dev_usage entries

    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 <[email protected]>
    koverstreet committed Jun 12, 2021
    Configuration menu
    Copy the full SHA
    b00cf89 View commit details
    Browse the repository at this point in the history
  4. bcachefs: Kill bch2_btree_iter_peek_cached()

    It's now been rolled into bch2_btree_iter_peek_slot()
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 12, 2021
    Configuration menu
    Copy the full SHA
    9e9ad82 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2021

  1. bcachefs: Don't underflow c->sectors_available

    This rarely used error path should've been checking for underflow -
    oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 13, 2021
    Configuration menu
    Copy the full SHA
    936a644 View commit details
    Browse the repository at this point in the history
  2. bcachefs: Clear iter->should_be_locked in bch2_trans_reset

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 13, 2021
    Configuration menu
    Copy the full SHA
    f1c2b21 View commit details
    Browse the repository at this point in the history
  3. bcachefs: fix a possible bcachefs checksum mapping error opt-checksum…

    … enum 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 <[email protected]>
    jpsollie authored and koverstreet committed Jun 13, 2021
    Configuration menu
    Copy the full SHA
    a881a9c View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2021

  1. bcachefs: Fix a memory leak in dio write path

    Commit c42bca9 "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 <[email protected]>
    koverstreet committed Jun 14, 2021
    Configuration menu
    Copy the full SHA
    3902501 View commit details
    Browse the repository at this point in the history
  2. bcachefs: Make sure bch2_trans_mark_update uses correct iter flags

    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 <[email protected]>
    koverstreet committed Jun 14, 2021
    Configuration menu
    Copy the full SHA
    32de9f8 View commit details
    Browse the repository at this point in the history
  3. bcachefs: Kill __btree_delete_at()

    With trans->updates2 gone, we can now drop this helper and use
    bch2_btree_delete_at() instead.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 14, 2021
    Configuration menu
    Copy the full SHA
    e9761f8 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2021

  1. bcachefs: Improve iter->should_be_locked

    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 <[email protected]>
    koverstreet committed Jun 15, 2021
    Configuration menu
    Copy the full SHA
    ee8c024 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3e0a69c View commit details
    Browse the repository at this point in the history
  3. bcachefs: fix truncate with ATTR_MODE

    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 <[email protected]>
    koverstreet committed Jun 15, 2021
    Configuration menu
    Copy the full SHA
    e256ef2 View commit details
    Browse the repository at this point in the history
  4. bcachefs: Extensive triggers cleanups

     - 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 <[email protected]>
    koverstreet committed Jun 15, 2021
    Configuration menu
    Copy the full SHA
    95ab81d View commit details
    Browse the repository at this point in the history
  5. bcachefs: Don't disable preemption unnecessarily

    Small improvements to some percpu utility code.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 15, 2021
    Configuration menu
    Copy the full SHA
    bf09fd4 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2021

  1. fixup! bcachefs: More topology repair code

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 16, 2021
    Configuration menu
    Copy the full SHA
    154c7c7 View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2021

  1. Configuration menu
    Copy the full SHA
    4cc1334 View commit details
    Browse the repository at this point in the history
  2. bcachefs: ensure iter->should_be_locked is set

    Ensure that iter->should_be_locked value is set to true before we
    call bch2_trans_update in ec_stripe_update_ptrs.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 17, 2021
    Configuration menu
    Copy the full SHA
    1a54de9 View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2021

  1. bcachefs: Don't ratelimit certain fsck errors

    It's unhelpful if we see "Halting mark and sweep to start topology
    repair" but we don't see the error that triggered it.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 21, 2021
    Configuration menu
    Copy the full SHA
    39ad803 View commit details
    Browse the repository at this point in the history
  2. bcachefs: Start journal reclaim thread earlier

    Especially in userspace, we sometime run into resource exhaustion issues
    with starting up threads after mark and sweep/fsck.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 21, 2021
    Configuration menu
    Copy the full SHA
    775b36b View commit details
    Browse the repository at this point in the history

Commits on Jun 22, 2021

  1. Configuration menu
    Copy the full SHA
    0df0b04 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2021

  1. bcachefs: Don't loop into topology repair

    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 23, 2021
    Configuration menu
    Copy the full SHA
    1054926 View commit details
    Browse the repository at this point in the history
  2. bcachefs: Fix btree_node_read_all_replicas() error handling

    We weren't checking bch2_btree_node_read_done() for errors, oops.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 23, 2021
    Configuration menu
    Copy the full SHA
    49e4c3b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ca3cfad View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2021

  1. bcachefs: Fix shift-by-64 in bch2_bkey_format_validate()

    We need to ensure that packed formats can't represent fields larger than
    the unpacked format, which is a bit tricky since the calculations can
    also overflow a u64. This patch fixes a shift and simplifies the overall
    calculations.
    
    Signed-off-by: Kent Overstreet <[email protected]>
    koverstreet committed Jun 24, 2021
    Configuration menu
    Copy the full SHA
    cec8dcc View commit details
    Browse the repository at this point in the history
  2. bcachefs: statfs bfree and bavail should be the same

    The value of f_bfree and f_bavail should be the same. The value of
    f_bfree is not currently scaled by the availability factor.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 24, 2021
    Configuration menu
    Copy the full SHA
    c7dea9c View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2021

  1. bcachefs: Fix bch2_acl_chmod() cleanup on error

    Avoid calling kfree on the returned error pointer if
    bch2_acl_from_disk fails.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson authored and koverstreet committed Jun 25, 2021
    Configuration menu
    Copy the full SHA
    21578ad View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2021

  1. bcachefs: fix initial page state after falloc

    When initializing the page state, set the page sectors state to
    that of what exists in the btree. This allows us to check if the
    backing extent was already allocated before adding to the inode
    i_blocks value.
    
    Signed-off-by: Dan Robertson <[email protected]>
    dlrobertson committed Jun 27, 2021
    Configuration menu
    Copy the full SHA
    3fe6e97 View commit details
    Browse the repository at this point in the history