public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] reduce boilerplate code within btrfs
@ 2024-12-17 21:58 Qu Wenruo
  2024-12-17 21:58 ` [PATCH v3 1/6] rbtree: add rb_find_add_cached() to rbtree.h Qu Wenruo
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Qu Wenruo @ 2024-12-17 21:58 UTC (permalink / raw)
  To: linux-btrfs

[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(-)

-- 
2.47.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-23 19:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 21:58 [PATCH v3 0/6] reduce boilerplate code within btrfs Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 1/6] rbtree: add rb_find_add_cached() to rbtree.h Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 2/6] btrfs: update btrfs_add_block_group_cache() to use rb helper Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 3/6] btrfs: update prelim_ref_insert() to use rb helpers Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 4/6] btrfs: update __btrfs_add_delayed_item() to use rb helper Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 5/6] btrfs: update btrfs_add_chunk_map() to use rb helpers Qu Wenruo
2024-12-17 21:58 ` [PATCH v3 6/6] btrfs: update tree_insert() " Qu Wenruo
2024-12-23 19:54 ` [PATCH v3 0/6] reduce boilerplate code within btrfs David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox