public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v3 0/6] reduce boilerplate code within btrfs
Date: Wed, 18 Dec 2024 08:28:49 +1030	[thread overview]
Message-ID: <cover.1734472236.git.wqu@suse.com> (raw)

[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


             reply	other threads:[~2024-12-17 21:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 21:58 Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1734472236.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox