public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref
@ 2025-11-22  6:00 Sun YangKai
  2025-11-22  6:00 ` [PATCH v2 1/2] btrfs: use true/false for " Sun YangKai
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sun YangKai @ 2025-11-22  6:00 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Sun YangKai

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

-- 
2.51.2


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

end of thread, other threads:[~2025-11-28  4:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-22  6:00 [PATCH v2 0/2] btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref Sun YangKai
2025-11-22  6:00 ` [PATCH v2 1/2] btrfs: use true/false for " Sun YangKai
2025-11-25 16:46   ` David Sterba
2025-11-28  4:13     ` Sun Yangkai
2025-11-22  6:00 ` [PATCH v2 2/2] btrfs: simplify boolean argument for btrfs_{inc,dec}_ref Sun YangKai
2025-11-22  6:51   ` Sun Yangkai
2025-11-25 16:33     ` David Sterba
2025-11-25 16:44 ` [PATCH v2 0/2] btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref David Sterba

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