Skip to content

Commit 70905f8

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove blk_flush_policy
Fold blk_flush_policy into the only caller to prepare for pending changes to it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20240617060532.127975-13-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent af28141 commit 70905f8

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

block/blk-flush.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,6 @@ blk_get_flush_queue(struct request_queue *q, struct blk_mq_ctx *ctx)
100100
return blk_mq_map_queue(q, REQ_OP_FLUSH, ctx)->fq;
101101
}
102102

103-
static unsigned int blk_flush_policy(unsigned long fflags, struct request *rq)
104-
{
105-
unsigned int policy = 0;
106-
107-
if (blk_rq_sectors(rq))
108-
policy |= REQ_FSEQ_DATA;
109-
110-
if (fflags & (1UL << QUEUE_FLAG_WC)) {
111-
if (rq->cmd_flags & REQ_PREFLUSH)
112-
policy |= REQ_FSEQ_PREFLUSH;
113-
if (!(fflags & (1UL << QUEUE_FLAG_FUA)) &&
114-
(rq->cmd_flags & REQ_FUA))
115-
policy |= REQ_FSEQ_POSTFLUSH;
116-
}
117-
return policy;
118-
}
119-
120103
static unsigned int blk_flush_cur_seq(struct request *rq)
121104
{
122105
return 1 << ffz(rq->flush.seq);
@@ -399,12 +382,26 @@ bool blk_insert_flush(struct request *rq)
399382
{
400383
struct request_queue *q = rq->q;
401384
unsigned long fflags = q->queue_flags; /* may change, cache */
402-
unsigned int policy = blk_flush_policy(fflags, rq);
403385
struct blk_flush_queue *fq = blk_get_flush_queue(q, rq->mq_ctx);
386+
unsigned int policy = 0;
404387

405388
/* FLUSH/FUA request must never be merged */
406389
WARN_ON_ONCE(rq->bio != rq->biotail);
407390

391+
if (blk_rq_sectors(rq))
392+
policy |= REQ_FSEQ_DATA;
393+
394+
/*
395+
* Check which flushes we need to sequence for this operation.
396+
*/
397+
if (fflags & (1UL << QUEUE_FLAG_WC)) {
398+
if (rq->cmd_flags & REQ_PREFLUSH)
399+
policy |= REQ_FSEQ_PREFLUSH;
400+
if (!(fflags & (1UL << QUEUE_FLAG_FUA)) &&
401+
(rq->cmd_flags & REQ_FUA))
402+
policy |= REQ_FSEQ_POSTFLUSH;
403+
}
404+
408405
/*
409406
* @policy now records what operations need to be done. Adjust
410407
* REQ_PREFLUSH and FUA for the driver.

0 commit comments

Comments
 (0)