diff options
author | Kent Overstreet <koverstreet@google.com> | 2013-05-11 15:59:37 -0700 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-06-26 17:09:16 -0700 |
commit | 6ded34d1a54c046a45db071d3cb7b37bd0a4a31f (patch) | |
tree | 1f2b7703d1be78e0ab510df54a487b746a8e2312 /drivers/md/bcache/super.c | |
parent | 85b1492ee113486d871de7676a61f506a43ca475 (diff) | |
download | blackbird-op-linux-6ded34d1a54c046a45db071d3cb7b37bd0a4a31f.tar.gz blackbird-op-linux-6ded34d1a54c046a45db071d3cb7b37bd0a4a31f.zip |
bcache: Improve lazy sorting
The old lazy sorting code was kind of hacky - rewrite in a way that
mathematically makes more sense; the idea is that the size of the sets
of keys in a btree node should increase by a more or less fixed ratio
from smallest to biggest.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Diffstat (limited to 'drivers/md/bcache/super.c')
-rw-r--r-- | drivers/md/bcache/super.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index f24c2e0cbb1c..3c8474161e8e 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1375,6 +1375,8 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) c->btree_pages = max_t(int, c->btree_pages / 4, BTREE_MAX_PAGES); + c->sort_crit_factor = int_sqrt(c->btree_pages); + mutex_init(&c->bucket_lock); mutex_init(&c->sort_lock); spin_lock_init(&c->sort_time_lock); |