bcache: Rename/shuffle various code around
More work to disentangle bset.c from the rest of the code:
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h
index 2a5a848..b354117 100644
--- a/drivers/md/bcache/btree.h
+++ b/drivers/md/bcache/btree.h
@@ -180,9 +180,9 @@
return b->writes + (btree_node_write_idx(b) ^ 1);
}
-static inline unsigned bset_offset(struct btree *b, struct bset *i)
+static inline struct bset_tree *bset_tree_last(struct btree *b)
{
- return (((size_t) i) - ((size_t) b->sets->data)) >> 9;
+ return b->sets + b->nsets;
}
static inline struct bset *btree_bset_first(struct btree *b)
@@ -190,6 +190,11 @@
return b->sets->data;
}
+static inline struct bset *btree_bset_last(struct btree *b)
+{
+ return bset_tree_last(b)->data;
+}
+
static inline unsigned bset_byte_offset(struct btree *b, struct bset *i)
{
return ((size_t) i) - ((size_t) b->sets->data);