Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4053079rwb; Sun, 30 Jul 2023 23:49:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlHBzw43CkM1M4GtXVfsIU/z8tRkZXWzkyVS0DiSi7OtthgANHslgJYnFtg7XLd8mpV6rGWD X-Received: by 2002:a05:6a20:2447:b0:134:2b44:decf with SMTP id t7-20020a056a20244700b001342b44decfmr8961471pzc.21.1690786165308; Sun, 30 Jul 2023 23:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690786165; cv=none; d=google.com; s=arc-20160816; b=y9TosRxUQ3a6NIlJvC5TfmJaA5LNhxd6pa2uz0KmUmMw9ygk3DkorDDwBl0tpkTD9S DVFL0/HiZyX3/Z1SOXhjZamjJ0/cvuX1K7cNKeL/WuMz6LW5clx8QLz4JaJMTWoUaFQP 6LQW8Hbld9zPEYuEqtvz/2/qCasSgdavTIs0AxZhBykWIzVgv3+4iiQB7XZqZeSsxn7D n9/vJypbrpOBJradRzUz0qEqejd6VAvcWMYBfvjflQqC2+GtOX4m4EkypEPFIMou8S23 Ksc5JNIiGqsqEjWWzk2G1peXJujqWtBxfxF4pxfTeJAXMeqv+8XKtukgBrznmPp9aYrD B9OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=S3cp1wAaELOI0X8Lrdn6u/d4fU7C+ZcYA1SW2G0Qu/s=; fh=1vuUTineNPguhZ+8zOKbSd1JaGAv1oLTdRFgyn7ljmw=; b=seXCcOgc3p1QF9DRSCA4YMphwyzPVLNi7X7ci6evzwzfG7Lv7PJdIA6+HReD+AKmV0 xqbYV8nNkzFaW0XfcTIdsqwJNrO1OCSYy5YOm4tmpEvd1UjpoCjeCSG+DSz49vsgcmF5 aO5YYlY4yP83lUcjIczgsW6YHEwbFazhzXcQ7b3dTPV0o54HMgnkkN0xDDpcAsLmEgpg kg/Nl1NE6FvCO34ml5oGqeh2g4GyzNjvjtP6xwsvdTUSw0SGFEwGfsWNjO8b+9xAdvWS OYG27pNtm5iBjJpmpB6BUKz5JnTWjlU7ivwqK9SCfqbvhHm/ZtNRu6lWr25DGlPsiFu0 3r8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a056a001bc600b006815bf78628si6672784pfw.356.2023.07.30.23.49.13; Sun, 30 Jul 2023 23:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbjGaGQU (ORCPT + 99 others); Mon, 31 Jul 2023 02:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbjGaGQR (ORCPT ); Mon, 31 Jul 2023 02:16:17 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EEF51713; Sun, 30 Jul 2023 23:15:57 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 736AE67373; Mon, 31 Jul 2023 08:15:21 +0200 (CEST) Date: Mon, 31 Jul 2023 08:15:21 +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 2/4] blk-flush: split queues for preflush and postflush requests Message-ID: <20230731061521.GB30409@lst.de> References: <20230725130102.3030032-1-chengming.zhou@linux.dev> <20230725130102.3030032-3-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725130102.3030032-3-chengming.zhou@linux.dev> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > - 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);