summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2023-11-20 13:25:02 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-20 15:38:02 +0100
commite8a5cddcb678cc72318b483c55431ece979c0e8b (patch)
treed34e602e4a255ddad98466fe78df70fe3b15183c
parent9e3d76f35aee4e825f5ff1ddc5b62ae24e74a82a (diff)
downloadlinux-stable-e8a5cddcb678cc72318b483c55431ece979c0e8b.tar.gz
linux-stable-e8a5cddcb678cc72318b483c55431ece979c0e8b.tar.bz2
linux-stable-e8a5cddcb678cc72318b483c55431ece979c0e8b.zip
bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
[ 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>
-rw-r--r--drivers/md/bcache/btree.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 3518088d7ff1..de1eb7961fe6 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1008,6 +1008,9 @@ err:
*
* 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,
@@ -1120,6 +1123,10 @@ retry:
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)