diff options
author | Tang Junhui <tang.junhui@zte.com.cn> | 2017-10-30 22:46:33 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-10-30 22:57:54 +0100 |
commit | d44c2f9e7cc0041f0cd88df1fe7a1fceb713ab14 (patch) | |
tree | 5aaefcfaf4f1a3679e85b831c2d685fff30681c3 /drivers/md/bcache/btree.h | |
parent | bcache: convert cached_dev.count from atomic_t to refcount_t (diff) | |
download | linux-d44c2f9e7cc0041f0cd88df1fe7a1fceb713ab14.tar.xz linux-d44c2f9e7cc0041f0cd88df1fe7a1fceb713ab14.zip |
bcache: update bucket_in_use in real time
bucket_in_use is updated in gc thread which triggered by invalidating or
writing sectors_to_gc dirty data, It's a long interval. Therefore, when we
use it to compare with the threshold, it is often not timely, which leads
to inaccurate judgment and often results in bucket depletion.
We have send a patch before, by the means of updating bucket_in_use
periodically In gc thread, which Coly thought that would lead high
latency, In this patch, we add avail_nbuckets to record the count of
available buckets, and we calculate bucket_in_use when alloc or free
bucket in real time.
[edited by ML: eliminated some whitespace errors]
Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/bcache/btree.h')
-rw-r--r-- | drivers/md/bcache/btree.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h index 73da1f5626cb..4073aca09a49 100644 --- a/drivers/md/bcache/btree.h +++ b/drivers/md/bcache/btree.h @@ -305,5 +305,5 @@ void bch_keybuf_del(struct keybuf *, struct keybuf_key *); struct keybuf_key *bch_keybuf_next(struct keybuf *); struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *, struct keybuf *, struct bkey *, keybuf_pred_fn *); - +void bch_update_bucket_in_use(struct cache_set *c, struct gc_stat *stats); #endif |