From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Sun YangKai <sunk67188@gmail.com>
Subject: [PATCH v2 0/2] btrfs: use true/false and simplify boolean parameters in btrfs_{inc,dec}_ref
Date: Sat, 22 Nov 2025 14:00:42 +0800 [thread overview]
Message-ID: <20251122063516.4516-2-sunk67188@gmail.com> (raw)
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
next reply other threads:[~2025-11-22 6:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 6:00 Sun YangKai [this message]
2025-11-22 6:00 ` [PATCH v2 1/2] btrfs: use true/false for boolean parameters in btrfs_{inc,dec}_ref 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
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=20251122063516.4516-2-sunk67188@gmail.com \
--to=sunk67188@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.