Commit 31f5b956 authored by Coly Li's avatar Coly Li Committed by Jens Axboe

bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()

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: default avatarColy Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20231120052503.6122-10-colyli@suse.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f72f4312
...@@ -1000,6 +1000,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op, ...@@ -1000,6 +1000,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 * The btree node will have either a read or a write lock held, depending on
* level and op->lock. * 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 btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,
struct bkey *k, int level, bool write, struct bkey *k, int level, bool write,
...@@ -1111,6 +1114,10 @@ static void btree_node_free(struct btree *b) ...@@ -1111,6 +1114,10 @@ static void btree_node_free(struct btree *b)
mutex_unlock(&b->c->bucket_lock); 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, struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
int level, bool wait, int level, bool wait,
struct btree *parent) struct btree *parent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment