aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/request.c
diff options
context:
space:
mode:
authorTang Junhui <tang.junhui@zte.com.cn>2018-07-26 00:17:34 -0400
committerJens Axboe <axboe@kernel.dk>2018-07-27 11:15:46 -0400
commit5c25c4fc74af40657606dd01df27cc5eb9efb26c (patch)
treebb8382641c55cf0104c0bb547ac864069ff80482 /drivers/md/bcache/request.c
parent99a27d59bd7b2ce1a82a4e826e8e7881f4d4954d (diff)
bcache: finish incremental GC
In GC thread, we record the latest GC key in gc_done, which is expected to be used for incremental GC, but in currently code, we didn't realize it. When GC runs, front side IO would be blocked until the GC over, it would be a long time if there is a lot of btree nodes. This patch realizes incremental GC, the main ideal is that, when there are front side I/Os, after GC some nodes (100), we stop GC, release locker of the btree node, and go to process the front side I/Os for some times (100 ms), then go back to GC again. By this patch, when we doing GC, I/Os are not blocked all the time, and there is no obvious I/Os zero jump problem any more. Patch v2: Rename some variables and macros name as Coly suggested. Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn> Signed-off-by: Coly Li <colyli@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/bcache/request.c')
-rw-r--r--drivers/md/bcache/request.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 97707b0c54ce..43af905920f5 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -701,6 +701,8 @@ static void search_free(struct closure *cl)
701{ 701{
702 struct search *s = container_of(cl, struct search, cl); 702 struct search *s = container_of(cl, struct search, cl);
703 703
704 atomic_dec(&s->d->c->search_inflight);
705
704 if (s->iop.bio) 706 if (s->iop.bio)
705 bio_put(s->iop.bio); 707 bio_put(s->iop.bio);
706 708
@@ -718,6 +720,7 @@ static inline struct search *search_alloc(struct bio *bio,
718 720
719 closure_init(&s->cl, NULL); 721 closure_init(&s->cl, NULL);
720 do_bio_hook(s, bio, request_endio); 722 do_bio_hook(s, bio, request_endio);
723 atomic_inc(&d->c->search_inflight);
721 724
722 s->orig_bio = bio; 725 s->orig_bio = bio;
723 s->cache_miss = NULL; 726 s->cache_miss = NULL;