mbox series

[v3,0/6] reduce boilerplate code within btrfs

Message ID cover.1734472236.git.wqu@suse.com (mailing list archive)
Headers show
Series reduce boilerplate code within btrfs | expand

Message

Qu Wenruo Dec. 17, 2024, 9:58 p.m. UTC
[Changelog]
v3:
- Fix the error handling in the 2nd patch

- Fix the backref walk failure
  There are two bugs in the 3rd patch:
  * Bad parent/ref pointer update
    Which only get updated once at the beginning, meanwhile they should
    be updated only when we found an existing node.
  * Order change for prelim_ref
    The prelim_ref_compare() require the first parameter to be the
    existing ref, and the second parameter to be the new one.
    This is different from the new rb_find_add_cached() order
  Fix both and remove unnecessary variables.

- Add named parameters for cmp() function used in rb_find_add_cached()
  To give a more explicit distinguish on which one should be the newer
  node and which should be the existing node.
  This should reduce the confusion on the order.

- Unify the parameters for cmp() functions
  And all internal entry structure will have corresponding "new_/exist_"
  prefix.

- Make all parameters of cmp() to be const

v2: By Roger L
- Fix error handing in the 2nd patch
  Which is still not done correctly

- Add Acked-by tag from Peter

The goal of this patch series is to reduce boilerplate code
within btrfs. To accomplish this rb_find_add_cached() was added
to linux/include/rbtree.h. Any replaceable functions were then 
replaced within btrfs.

changelog: 
updated if() statements to utilize newer error checking
resolved lock error on 0002
edited title of patches to utilize update instead of edit
added Acked-by from Peter Zijlstra to 0001
eliminated extra variables throughout the patch series

Roger L. Beckermeyer III (6):
  rbtree: add rb_find_add_cached() to rbtree.h
  btrfs: update btrfs_add_block_group_cache() to use rb helper
  btrfs: update prelim_ref_insert() to use rb helpers
  btrfs: update __btrfs_add_delayed_item() to use rb helper
  btrfs: update btrfs_add_chunk_map() to use rb helpers
  btrfs: update tree_insert() to use rb helpers

 fs/btrfs/backref.c       | 79 ++++++++++++++++++++--------------------
 fs/btrfs/block-group.c   | 46 +++++++++++------------
 fs/btrfs/delayed-inode.c | 43 ++++++++++------------
 fs/btrfs/delayed-ref.c   | 45 +++++++++--------------
 fs/btrfs/volumes.c       | 41 +++++++++++----------
 include/linux/rbtree.h   | 37 +++++++++++++++++++
 6 files changed, 156 insertions(+), 135 deletions(-)