From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Coly Li <colyli@suse.de>, Jens Axboe <axboe@kernel.dk>,
Sasha Levin <sashal@kernel.org>,
kent.overstreet@gmail.com, linux-bcache@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 04/11] bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
Date: Tue, 28 Nov 2023 16:09:28 -0500 [thread overview]
Message-ID: <20231128210941.877094-4-sashal@kernel.org> (raw)
In-Reply-To: <20231128210941.877094-1-sashal@kernel.org>
From: Coly Li <colyli@suse.de>
[ Upstream commit 31f5b956a197d4ec25c8a07cb3a2ab69d0c0b82f ]
This patch adds code comments to bch_btree_node_get() and
__bch_btree_node_alloc() that NULL pointer will not be returned and it
is unnecessary to check NULL pointer by the callers of these routines.
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20231120052503.6122-10-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/md/bcache/btree.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index cc0c1f2bba45c..26b4ff6be3723 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1020,6 +1020,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op,
*
* The btree node will have either a read or a write lock held, depending on
* level and op->lock.
+ *
+ * Note: Only error code or btree pointer will be returned, it is unncessary
+ * for callers to check NULL pointer.
*/
struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,
struct bkey *k, int level, bool write,
@@ -1132,6 +1135,10 @@ static void btree_node_free(struct btree *b)
mutex_unlock(&b->c->bucket_lock);
}
+/*
+ * Only error code or btree pointer will be returned, it is unncessary for
+ * callers to check NULL pointer.
+ */
struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
int level, bool wait,
struct btree *parent)
--
2.42.0
next prev parent reply other threads:[~2023-11-28 21:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 21:09 [PATCH AUTOSEL 5.4 01/11] usb: aqc111: check packet for fixup for true limit Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 02/11] blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!" Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 03/11] bcache: avoid oversize memory allocation by small stripe_size Sasha Levin
2023-11-28 21:09 ` Sasha Levin [this message]
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 05/11] bcache: avoid NULL checking to c->root in run_cache_set() Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 06/11] platform/x86: intel_telemetry: Fix kernel doc descriptions Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 07/11] HID: add ALWAYS_POLL quirk for Apple kb Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 08/11] HID: hid-asus: reset the backlight brightness level on resume Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 09/11] HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 10/11] asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation Sasha Levin
2023-11-28 21:09 ` [PATCH AUTOSEL 5.4 11/11] net: usb: qmi_wwan: claim interface 4 for ZTE MF290 Sasha Levin
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=20231128210941.877094-4-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=kent.overstreet@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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.