bcache: Initialize sectors_dirty when attaching
[deliverable/linux.git] / drivers / md / bcache / super.c
index f24c2e0cbb1c199755894817f05a2f29c07d42ac..dbfa1c38e85e331a3ecd9e3d1f5985158c9b1abf 100644 (file)
@@ -961,6 +961,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
        atomic_set(&dc->count, 1);
 
        if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
+               bch_sectors_dirty_init(dc);
                atomic_set(&dc->has_dirty, 1);
                atomic_inc(&dc->count);
                bch_writeback_queue(dc);
@@ -1375,6 +1376,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);
This page took 0.044771 seconds and 5 git commands to generate.