summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/btree.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache/btree.h')
-rw-r--r--drivers/md/bcache/btree.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h
index 608d947de373..e08d68650d7d 100644
--- a/drivers/md/bcache/btree.h
+++ b/drivers/md/bcache/btree.h
@@ -289,6 +289,19 @@ void bch_btree_iter_set_pos(struct btree_iter *, struct bpos);
void bch_btree_iter_advance_pos(struct btree_iter *);
bool bch_btree_iter_upgrade(struct btree_iter *);
+static inline struct bpos __bch_btree_iter_advance_pos(struct btree_iter *iter,
+ struct bpos pos)
+{
+ if (iter->btree_id == BTREE_ID_INODES) {
+ pos.inode++;
+ pos.offset = 0;
+ } else if (iter->btree_id != BTREE_ID_EXTENTS) {
+ pos = bkey_successor(pos);
+ }
+
+ return pos;
+}
+
static inline void __btree_iter_node_set(struct btree_iter *iter,
struct btree *b,
struct bpos pos)