ANDROID: block: Send FUA requests to the I/O scheduler

Send requests with the REQ_FUA or REQ_PREFLUSH flag set to the I/O
scheduler. Do not change the behavior for REQ_OP_FLUSH requests.
This patch prevents that zoned writes with the REQ_FUA and/or
REQ_PREFLUSH flag set are reordered against each other.

Bug: 275581839
Change-Id: Ib7f18932a066c40f5b76dc69c1864a080350251d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2023-03-31 09:39:07 -07:00
committed by Treehugger Robot
parent 0545a08098
commit cd4d66e62b
3 changed files with 6 additions and 7 deletions

View File

@@ -423,7 +423,7 @@ void blk_insert_flush(struct request *rq)
*/
if ((policy & REQ_FSEQ_DATA) &&
!(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) {
blk_mq_request_bypass_insert(rq, false, false);
blk_mq_sched_insert_request(rq, false, false, false);
return;
}

View File

@@ -425,7 +425,7 @@ static bool blk_mq_sched_bypass_insert(struct request *rq)
* passthrough request is added to scheduler queue, there isn't any
* chance to dispatch it given we prioritize requests in hctx->dispatch.
*/
return (rq->rq_flags & RQF_FLUSH_SEQ) || blk_rq_is_passthrough(rq);
return req_op(rq) == REQ_OP_FLUSH || blk_rq_is_passthrough(rq);
}
void blk_mq_sched_insert_request(struct request *rq, bool at_head,

View File

@@ -336,7 +336,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
data->ctx->rq_dispatched[op_is_sync(data->cmd_flags)]++;
refcount_set(&rq->ref, 1);
if (!op_is_flush(data->cmd_flags)) {
if ((data->cmd_flags & REQ_OP_MASK) != REQ_OP_FLUSH) {
struct elevator_queue *e = data->q->elevator;
rq->elv.icq = NULL;
@@ -370,11 +370,10 @@ static struct request *__blk_mq_alloc_request(struct blk_mq_alloc_data *data)
if (e) {
/*
* Flush/passthrough requests are special and go directly to the
* dispatch list. Don't include reserved tags in the
* limiting, as it isn't useful.
* Do not limit the depth for passthrough requests nor for flush
* requests nor for requests with a reserved tag.
*/
if (!op_is_flush(data->cmd_flags) &&
if ((data->cmd_flags & REQ_OP_MASK) != REQ_OP_FLUSH &&
!blk_op_is_passthrough(data->cmd_flags) &&
e->type->ops.limit_depth &&
!(data->flags & BLK_MQ_REQ_RESERVED))