bcache: use op_is_sync to check for synchronous requests
authorChristoph Hellwig <hch@lst.de>
Tue, 1 Nov 2016 13:40:05 +0000 (07:40 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 1 Nov 2016 15:43:26 +0000 (09:43 -0600)
(and remove one layer of masking for the op_is_write call next to it).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/md/bcache/request.c
drivers/md/bcache/writeback.h

index 40ffe5e424b3025d562a63e5bae9fd1c1d78f2a3..e8a2b693c9288351c0d0b2d4c2809c4afecf1e7a 100644 (file)
@@ -404,8 +404,8 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
 
        if (!congested &&
            mode == CACHE_MODE_WRITEBACK &&
-           op_is_write(bio_op(bio)) &&
-           (bio->bi_opf & REQ_SYNC))
+           op_is_write(bio->bi_opf) &&
+           op_is_sync(bio->bi_opf))
                goto rescale;
 
        spin_lock(&dc->io_lock);
index 301eaf5651673ffd0c2401efb97a70fe07e5cb44..629bd1a502fdf03b291aad194d17847491e4a7e6 100644 (file)
@@ -57,8 +57,7 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
        if (would_skip)
                return false;
 
-       return bio->bi_opf & REQ_SYNC ||
-               in_use <= CUTOFF_WRITEBACK;
+       return op_is_sync(bio->bi_opf) || in_use <= CUTOFF_WRITEBACK;
 }
 
 static inline void bch_writeback_queue(struct cached_dev *dc)