From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7BCEC04A94 for ; Mon, 31 Jul 2023 06:19:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbjGaGTp (ORCPT ); Mon, 31 Jul 2023 02:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjGaGTm (ORCPT ); Mon, 31 Jul 2023 02:19:42 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2649D194; Sun, 30 Jul 2023 23:19:41 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id B1AA367373; Mon, 31 Jul 2023 08:19:37 +0200 (CEST) Date: Mon, 31 Jul 2023 08:19:37 +0200 From: Christoph Hellwig To: chengming.zhou@linux.dev Cc: axboe@kernel.dk, hch@lst.de, ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com Subject: Re: [PATCH v2 3/4] blk-flush: kill the flush state machine Message-ID: <20230731061937.GC30409@lst.de> References: <20230725130102.3030032-1-chengming.zhou@linux.dev> <20230725130102.3030032-4-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725130102.3030032-4-chengming.zhou@linux.dev> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 25, 2023 at 09:01:01PM +0800, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > 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.