Skip to content

Commit 31f5b95

Browse files
Coly Liaxboe
authored andcommitted
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: 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>
1 parent f72f431 commit 31f5b95

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/md/bcache/btree.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op,
10001000
*
10011001
* The btree node will have either a read or a write lock held, depending on
10021002
* level and op->lock.
1003+
*
1004+
* Note: Only error code or btree pointer will be returned, it is unncessary
1005+
* for callers to check NULL pointer.
10031006
*/
10041007
struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,
10051008
struct bkey *k, int level, bool write,
@@ -1111,6 +1114,10 @@ static void btree_node_free(struct btree *b)
11111114
mutex_unlock(&b->c->bucket_lock);
11121115
}
11131116

1117+
/*
1118+
* Only error code or btree pointer will be returned, it is unncessary for
1119+
* callers to check NULL pointer.
1120+
*/
11141121
struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
11151122
int level, bool wait,
11161123
struct btree *parent)

0 commit comments

Comments
 (0)