[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230731061937.GC30409@lst.de>
Date:   Mon, 31 Jul 2023 08:19:37 +0200
From:   Christoph Hellwig <hch@....de>
To:     chengming.zhou@...ux.dev
Cc:     axboe@...nel.dk, hch@....de, ming.lei@...hat.com,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhouchengming@...edance.com
Subject: Re: [PATCH v2 3/4] blk-flush: kill the flush state machine
On Tue, Jul 25, 2023 at 09:01:01PM +0800, chengming.zhou@...ux.dev wrote:
> From: Chengming Zhou <zhouchengming@...edance.com>
> 
> Since now we put preflush and postflush requests in separate queues,
> we don't need the flush sequence to record anymore.
> 
> REQ_FSEQ_PREFLUSH: blk_enqueue_preflush()
> REQ_FSEQ_POSTFLUSH: blk_enqueue_postflush()
> REQ_FSEQ_DONE: blk_end_flush()
> 
> In blk_flush_complete(), we have two list to handle: preflush_running
> and postflush_running. We just blk_end_flush() directly for postflush
> requests, but need to move preflush requests to requeue_list to
> dispatch.
> 
> This patch just kill the flush state machine and directly call these
> functions, in preparation for the next patch.
> +static void blk_enqueue_postflush(struct request *rq, struct blk_flush_queue *fq)
Please avoid the overly long here.  Maybe just rename enqueue to queue
here and for the preflush version as we don't really use enqueue in
the flush code anyway.
> +{
> +	unsigned int nr_requeue = 0;
> +	struct list_head *preflush_running;
> +	struct list_head *postflush_running;
> +	struct request *rq, *n;
> +
> +	preflush_running = &fq->preflush_queue[fq->flush_running_idx];
> +	postflush_running = &fq->postflush_queue[fq->flush_running_idx];
I'd initialize these ad declaration time:
	struct list_head *preflush_running =
		&fq->preflush_queue[fq->flush_running_idx];
	struct list_head *postflush_running =
		&fq->postflush_queue[fq->flush_running_idx];
	unsigned int nr_requeue = 0;
	struct request *rq, *n;
> +
> +	list_for_each_entry_safe(rq, n, postflush_running, queuelist) {
> +		blk_end_flush(rq, fq, error);
>  	}
No need for the braces.
Powered by blists - more mailing lists