Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4530163rwo; Tue, 25 Jul 2023 07:25:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvMTsORfQZeIvcPKRaAUu1joHzxQwBOS20OvVmfomWTjec6FVGv/9lI6Jae0otjz2FrHbE X-Received: by 2002:a17:90a:c56:b0:268:dad:2fdc with SMTP id u22-20020a17090a0c5600b002680dad2fdcmr7177068pje.21.1690295103463; Tue, 25 Jul 2023 07:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690295103; cv=none; d=google.com; s=arc-20160816; b=R6jEtNcakS13NOlcsJzp/ssszfmfM1cWLFhMssu4//LuaBUuy5CMdd4U4YhDcuxKi1 Cd/tFkLNpTDb+Ju2iWVSon6jX5b+9F4bvPoPM1j4kt3ahVE9dozceFYHo4Namef8gJLK aBlP7aM4Wr+ZGrXV+3oECRNbqztsjgnb/1yLg7yn8iUTJxEKFc20hbC1dOaTT+LSw/Qf mYKC6m2wcvQdd1AqhDV1JUSsVD/uHtpdnEkamPVe6+d6Woyn/gZnE2dk4kEwa/Pdkyd3 sNVyxaKrCh9uZdr10LS80B6SEdc62pA0gbNyqojrCDxIKgGQqwhyF5F6QzCIbYxK28IV BLtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=hDKCYqmLWyHXFEhC5Nj4kCjQ8+MggR2zRPLevzxTPPg=; fh=jOguULFzKD0eP94aYDSt0kpm1rHPvAOwZRdRG2JmQN4=; b=UaWfvon0CGjCPq4HqY7KEsRWEpCYPapUoZVjNdSrMb+k6B/9ciBweavyUByrI4qTB7 3JRzF0MR7tV3l/1Rk7AWwe3JsT6zQdQU5/wu/BDCzCX9yPzkfSHgKFtO/PKHgrMs8EOp htfaSIXg8bao3rY/CdINzsE5vqJjwYFJgg/T3p0HTn6ew855X1Utb4vFgdGAr0aN8o6K +QimuvADMM47W+D39xhruSQNNjWShJIw8bb/sTklwJzdT6i6KceZeAmiXDayBa/a48e2 M9GwHzRGZRAbcs+C34MNF+sjUqsdtF5y21Gxl/VLN7uZCllNfFpoANrAXHEMDQuu+CgE ZFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=AT6j2pP3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a17090a744600b00260a7aee610si2059092pjk.152.2023.07.25.07.24.41; Tue, 25 Jul 2023 07:25:03 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=AT6j2pP3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229437AbjGYNQL (ORCPT + 99 others); Tue, 25 Jul 2023 09:16:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjGYNQJ (ORCPT ); Tue, 25 Jul 2023 09:16:09 -0400 Received: from out-29.mta0.migadu.com (out-29.mta0.migadu.com [91.218.175.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FDD419A2 for ; Tue, 25 Jul 2023 06:16:07 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690290965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hDKCYqmLWyHXFEhC5Nj4kCjQ8+MggR2zRPLevzxTPPg=; b=AT6j2pP3iTuXIwEM6ohKAGMBJoX9RDzGMkQr+qnHxMi4Du1eG9ubu7oHFYfiiF72gxgxyt tFS5P3V3EOA0VLvwDcQZGACZHkPq3hsTMzTLlQHRkeV01S/wnbFiFZc4/PIRMexRNP4V78 2r61ZVk3kzJrbVZxTcJeKlZd0dnUUQw= Date: Tue, 25 Jul 2023 21:15:59 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 2/2] blk-flush: don't need to end rq twice for non post-flush requests Content-Language: en-US To: Christoph Hellwig Cc: axboe@kernel.dk, ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com References: <20230710064705.1847287-1-chengming.zhou@linux.dev> <20230710064705.1847287-2-chengming.zhou@linux.dev> <20230710133308.GB23157@lst.de> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20230710133308.GB23157@lst.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 2023/7/10 21:33, Christoph Hellwig wrote: > On Mon, Jul 10, 2023 at 02:47:05PM +0800, chengming.zhou@linux.dev wrote: >> From: Chengming Zhou >> >> Now we unconditionally blk_rq_init_flush() to replace rq->end_io to >> make rq return twice back to the flush state machine for post-flush. >> >> Obviously, non post-flush requests don't need it, they don't need to >> end request twice, so they don't need to replace rq->end_io callback. >> And the same for requests with the FUA bit on hardware with FUA support. >> >> So we move blk_rq_init_flush() to REQ_FSEQ_DATA stage and only replace >> rq->end_io if it needs post-flush. Otherwise, it can end like normal >> request and doesn't need to return back to the flush state machine. > > I really like the idea behind this optimization, but I kinda hate > adding more magic to the already way too magic flush sequence. Yes, agree. > > I wonder if a better idea would be to kill the flush sequence entirely, > and just split the flush_queue into a preflush and a postflush queue. > This would remove a field from struct request and lead to more readable > code as well. I have thought about this for some time, it seems feasible. So I implement it today and test it using blktests, it works. I will send the patchset soon. Thanks.