summaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/bset.h
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-09-10 22:53:34 -0700
committerKent Overstreet <kmo@daterainc.com>2014-01-08 13:05:12 -0800
commit67539e85289c14a76a1c4162613d14a5f05a0027 (patch)
tree7650b78775bf7b9f2b92113606d92a4a838a6753 /drivers/md/bcache/bset.h
parent911c9610099f26e9e6ea3d1962ce24f53890b163 (diff)
downloadblackbird-obmc-linux-67539e85289c14a76a1c4162613d14a5f05a0027.tar.gz
blackbird-obmc-linux-67539e85289c14a76a1c4162613d14a5f05a0027.zip
bcache: Add struct bset_sort_state
More disentangling bset.c from the rest of the bcache code - soon, the sorting routines won't have any dependencies on any outside structs. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/bset.h')
-rw-r--r--drivers/md/bcache/bset.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/drivers/md/bcache/bset.h b/drivers/md/bcache/bset.h
index 91bcbdb04085..4f60c21c7a38 100644
--- a/drivers/md/bcache/bset.h
+++ b/drivers/md/bcache/bset.h
@@ -3,6 +3,8 @@
#include <linux/slab.h>
+#include "util.h" /* for time_stats */
+
/*
* BKEYS:
*
@@ -190,6 +192,33 @@ struct bset_tree {
struct bset *data;
};
+/* Sorting */
+
+struct bset_sort_state {
+ mempool_t *pool;
+
+ unsigned page_order;
+ unsigned crit_factor;
+
+ struct time_stats time;
+};
+
+void bch_bset_sort_state_free(struct bset_sort_state *);
+int bch_bset_sort_state_init(struct bset_sort_state *, unsigned);
+void bch_btree_sort_lazy(struct btree *, struct bset_sort_state *);
+void bch_btree_sort_into(struct btree *, struct btree *,
+ struct bset_sort_state *);
+void bch_btree_sort_and_fix_extents(struct btree *, struct btree_iter *,
+ struct bset_sort_state *);
+void bch_btree_sort_partial(struct btree *, unsigned,
+ struct bset_sort_state *);
+
+static inline void bch_btree_sort(struct btree *b,
+ struct bset_sort_state *state)
+{
+ bch_btree_sort_partial(b, 0, state);
+}
+
/* Keylists */
struct keylist {
@@ -374,15 +403,6 @@ static inline struct bkey *bch_bset_search(struct btree *b, struct bset_tree *t,
})
bool bch_bkey_try_merge(struct btree *, struct bkey *, struct bkey *);
-void bch_btree_sort_lazy(struct btree *);
-void bch_btree_sort_into(struct btree *, struct btree *);
-void bch_btree_sort_and_fix_extents(struct btree *, struct btree_iter *);
-void bch_btree_sort_partial(struct btree *, unsigned);
-
-static inline void bch_btree_sort(struct btree *b)
-{
- bch_btree_sort_partial(b, 0);
-}
int bch_bset_print_stats(struct cache_set *, char *);
OpenPOWER on IntegriCloud