]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
bcache: fix sequential large write IO bypass
authorTang Junhui <tang.junhui@zte.com.cn>
Wed, 6 Sep 2017 06:25:52 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:43:21 +0000 (14:43 +0200)
commit c81ffa32a214c84b08900fbc9d432187bd948eba upstream.

Sequential write IOs were tested with bs=1M by FIO in writeback cache
mode, these IOs were expected to be bypassed, but actually they did not.
We debug the code, and find in check_should_bypass():
    if (!congested &&
        mode == CACHE_MODE_WRITEBACK &&
        op_is_write(bio_op(bio)) &&
        (bio->bi_opf & REQ_SYNC))
        goto rescale
that means, If in writeback mode, a write IO with REQ_SYNC flag will not
be bypassed though it is a sequential large IO, It's not a correct thing
to do actually, so this patch remove these codes.

Signed-off-by: tang.junhui <tang.junhui@zte.com.cn>
Reviewed-by: Kent Overstreet <kent.overstreet@gmail.com>
Reviewed-by: Eric Wheeler <bcache@linux.ewheeler.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/request.c

index c53cc00202c8dc9e20e4d91638d143ac33ea02dc..4b413db99276970b5feb816032a6e6eddaabad60 100644 (file)
@@ -400,12 +400,6 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
        if (!congested && !dc->sequential_cutoff)
                goto rescale;
 
-       if (!congested &&
-           mode == CACHE_MODE_WRITEBACK &&
-           op_is_write(bio->bi_opf) &&
-           op_is_sync(bio->bi_opf))
-               goto rescale;
-
        spin_lock(&dc->io_lock);
 
        hlist_for_each_entry(i, iohash(dc, bio->bi_iter.bi_sector), hash)