]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
bcache: do not subtract sectors_to_gc for bypassed IO
authorTang Junhui <tang.junhui@zte.com.cn>
Wed, 6 Sep 2017 06:25:53 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:43:21 +0000 (14:43 +0200)
commit 69daf03adef5f7bc13e0ac86b4b8007df1767aab upstream.

Since bypassed IOs use no bucket, so do not subtract sectors_to_gc to
trigger gc thread.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
Acked-by: Coly Li <colyli@suse.de>
Reviewed-by: Eric Wheeler <bcache@linux.ewheeler.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/request.c

index 019b3df9f1c603be4a7d2ad0b6d1de05ad6a2711..c53cc00202c8dc9e20e4d91638d143ac33ea02dc 100644 (file)
@@ -196,12 +196,12 @@ static void bch_data_insert_start(struct closure *cl)
        struct data_insert_op *op = container_of(cl, struct data_insert_op, cl);
        struct bio *bio = op->bio, *n;
 
-       if (atomic_sub_return(bio_sectors(bio), &op->c->sectors_to_gc) < 0)
-               wake_up_gc(op->c);
-
        if (op->bypass)
                return bch_data_invalidate(cl);
 
+       if (atomic_sub_return(bio_sectors(bio), &op->c->sectors_to_gc) < 0)
+               wake_up_gc(op->c);
+
        /*
         * Journal writes are marked REQ_PREFLUSH; if the original write was a
         * flush, it'll wait on the journal write.