bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
authorColy Li <colyli@suse.de>
Mon, 20 Nov 2023 05:25:02 +0000 (13:25 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 20 Nov 2023 16:17:51 +0000 (09:17 -0700)
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>
drivers/md/bcache/btree.c

index 79f1fa4a0d5518417c7a7936993eb8396fef3643..de3019972b355121fdf836af3f56fd9a949aeff9 100644 (file)
@@ -1000,6 +1000,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,
@@ -1111,6 +1114,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)