lkml.org 
[lkml]   [2023]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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);

\
 
 \ /
  Last update: 2023-07-31 08:17    [W:0.126 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site