Messages in this thread | | | Date | Mon, 31 Jul 2023 08:15:21 +0200 | From | Christoph Hellwig <> | Subject | Re: [PATCH v2 2/4] blk-flush: split queues for preflush and postflush requests |
| |
> - list_for_each_entry_safe(rq, n, running, queuelist) { > + list_for_each_entry_safe(rq, n, preflush_running, queuelist) { > + unsigned int seq = blk_flush_cur_seq(rq); > + > + BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH); > + blk_flush_complete_seq(rq, fq, seq, error); > + } > + > + list_for_each_entry_safe(rq, n, postflush_running, queuelist) { > unsigned int seq = blk_flush_cur_seq(rq); > > BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH);
Shouldn't the BUG_ON be split into one that only checks for PREFLUSH and one only for POSTFLUSH?
> + if (fq->flush_pending_idx != fq->flush_running_idx) > + return; > + > + if (!list_empty(preflush_pending)) > + first_rq = list_first_entry(preflush_pending, struct request, queuelist); > + else if (!list_empty(postflush_pending)) > + first_rq = list_first_entry(postflush_pending, struct request, queuelist); > + else > return;
Hmm, I don't think both lists can be empty here?
I'd simplify this and avoid the overly long lines as:
first_rq = list_first_entry_or_null(preflush_pending, struct request, queuelist); if (!first_rq) first_rq = list_first_entry_or_null(postflush_pending, struct request, queuelist);
| |