Skip to content

reduce boilerplate code within btrfs

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest6 patches 1 replyIn review

Changes in v3 from the cover letter

- 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

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6rbtree: add rb_find_add_cached() to rbtree.hinclude/linux/rbtree.h+37 -00 replies
2/6btrfs: update btrfs_add_block_group_cache() to use rb helperfs/btrfs/block-group.c+22 -240 replies
3/6btrfs: update prelim_ref_insert() to use rb helpersfs/btrfs/backref.c+39 -400 replies
4/6btrfs: update __btrfs_add_delayed_item() to use rb helperfs/btrfs/delayed-inode.c+19 -240 replies
5/6btrfs: update btrfs_add_chunk_map() to use rb helpersfs/btrfs/volumes.c+21 -200 replies
6/6btrfs: update tree_insert() to use rb helpersfs/btrfs/delayed-ref.c+18 -270 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPeter Zijlstra (Intel)Qu WenruoDavid Sterba
SeriesR-b
1/6A-b R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/6] reduce boilerplate code within 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(-)
Signature · 1 line
2.47.1