block: add a op_is_flush helper
This centralizes the checks for bios that needs to be go into the flush state machine. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:

committed by
Jens Axboe

parent
c13660a08c
commit
f73f44eb00
@@ -787,8 +787,7 @@ static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio)
|
||||
struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size);
|
||||
|
||||
spin_lock_irqsave(&cache->lock, flags);
|
||||
if (cache->need_tick_bio &&
|
||||
!(bio->bi_opf & (REQ_FUA | REQ_PREFLUSH)) &&
|
||||
if (cache->need_tick_bio && !op_is_flush(bio->bi_opf) &&
|
||||
bio_op(bio) != REQ_OP_DISCARD) {
|
||||
pb->tick = true;
|
||||
cache->need_tick_bio = false;
|
||||
@@ -828,11 +827,6 @@ static dm_oblock_t get_bio_block(struct cache *cache, struct bio *bio)
|
||||
return to_oblock(block_nr);
|
||||
}
|
||||
|
||||
static int bio_triggers_commit(struct cache *cache, struct bio *bio)
|
||||
{
|
||||
return bio->bi_opf & (REQ_PREFLUSH | REQ_FUA);
|
||||
}
|
||||
|
||||
/*
|
||||
* You must increment the deferred set whilst the prison cell is held. To
|
||||
* encourage this, we ask for 'cell' to be passed in.
|
||||
@@ -884,7 +878,7 @@ static void issue(struct cache *cache, struct bio *bio)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (!bio_triggers_commit(cache, bio)) {
|
||||
if (!op_is_flush(bio->bi_opf)) {
|
||||
accounted_request(cache, bio);
|
||||
return;
|
||||
}
|
||||
@@ -1069,8 +1063,7 @@ static void dec_io_migrations(struct cache *cache)
|
||||
|
||||
static bool discard_or_flush(struct bio *bio)
|
||||
{
|
||||
return bio_op(bio) == REQ_OP_DISCARD ||
|
||||
bio->bi_opf & (REQ_PREFLUSH | REQ_FUA);
|
||||
return bio_op(bio) == REQ_OP_DISCARD || op_is_flush(bio->bi_opf);
|
||||
}
|
||||
|
||||
static void __cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell)
|
||||
|
Reference in New Issue
Block a user