Skip to content

btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref

Sun YangKai linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 5 repliesIn review
  2. v12 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Introduce local variable for the conditions in patch 2, suggested by Boris

- Merge the non-zero ret handling blocks in btrfs_copy_root()

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: use true/false for boolean parameters in btrfs_{inc,dec}_reffs/btrfs/ctree.c fs/btrfs/extent-tree.c+14 -142 replies
2/2btrfs: simplify boolean argument for btrfs_{inc,dec}_reffs/btrfs/ctree.c fs/btrfs/extent-tree.c+17 -382 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref

This tiny series removes the last 0/1 integer literals passed to btrfs_inc_ref() / btrfs_dec_ref() and replaces the open-coded if/else blocks with concise boolean expressions.

Patch 1 switches the callsites to the self-documenting true/false constants, eliminating the implicit bool <-> int mixing.

Patch 2 folds the remaining if/else ladders into a single line using the condition directly, which shrinks the code and makes the intent obvious.

No functional change.

[Changelog]

v2:

- Introduce local variable for the conditions in patch 2, suggested by Boris

- Merge the non-zero ret handling blocks in btrfs_copy_root()

Sun YangKai (2):
btrfs: use true/false for boolean parameters in btrfs_{inc,dec}_ref
btrfs: simplify boolean argument for btrfs_{inc,dec}_ref

 fs/btrfs/ctree.c       | 46 +++++++++++++++---------------------------
 fs/btrfs/extent-tree.c | 21 +++++++------------
 2 files changed, 23 insertions(+), 44 deletions(-)
Signature · 1 line
2.51.2