Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4049251rwb; Sun, 30 Jul 2023 23:43:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlGI39hrQzGOsxkiDKb6gqq7TNxsB/2edG41ogNbjCOwAoqU2W9QqpPZOpdsg5P4VKqW4qvc X-Received: by 2002:a05:6512:3d8a:b0:4fd:d939:fcf7 with SMTP id k10-20020a0565123d8a00b004fdd939fcf7mr5764143lfv.49.1690785818209; Sun, 30 Jul 2023 23:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690785818; cv=none; d=google.com; s=arc-20160816; b=LoCa/L99zwREVJz6EzFA/2woJkDtZwR410PG2bJcuZvfDqXV15Gkr5TUNAO+OramiR gABTWLTEjGKZSf1GuPDN1NTkaUVrf2XRPjPQoPVTmmjTfAeuJp/vXMLjg+JMm/C8XNco MErH/qErEZwn67UIFv/T1yH89y0IRYIGNfvqRC+8AWTg3Of/9NtJxKjRu+jHB9sSCbl/ maINfzHM/n9I/hvOEUOdlzwu+6sz6q/tJ8/Repd11bcJs0JvUCSQwMqiRQC8Xj7non9o RT5zN1CHOBM9JrzljC84HMICDtA8zY9WUN6+JyH6elgoFV1Bk0uvPRpjNUPLH96PIIu2 FYLw== 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=/AJEItccrWgvmyikV6Ths3N/cgwZlFUIn9LJjKZaR3g=; fh=eZFYFriV70WkK7vXhPKkdcGgwbI5U4EwwZBOEsQdXZw=; b=mpjfJ/keu0JUev9GPgZfhN9T9McfwhlITNIU+XINe4ZUrbQO5y9W45NS9yrVSNScDD sW3PjoqNpMCKCvq/JQ1SYi6vrVQfHRa/bhWtCeVnNnlSmhI2yt5qKk+d6SJvQ4T2YUP0 JpiObW3MzpSOKQRpSRU7oza2vNtTlrNqXx64sf35Lir4WAibR7jMUUqbrr1gG8yOYEOG 9fDrJ90ENotgXItrqpryIh5AErQt8yMiez7yuWUqP++O7pn7+EaBHmq/nZHbiglmISk9 uVn2naCoWwn2h+HOFpKSIGCFXkgI+qMHiCuQhviYiQBPMKatUPYly8qBN/O5gvFRNfqF 5pOQ== 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 e15-20020a056402148f00b005227524ed19si6174501edv.513.2023.07.30.23.43.14; Sun, 30 Jul 2023 23:43:38 -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 S229902AbjGaGKD (ORCPT + 99 others); Mon, 31 Jul 2023 02:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbjGaGKC (ORCPT ); Mon, 31 Jul 2023 02:10:02 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67DE0CA; Sun, 30 Jul 2023 23:10:01 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id A156E67373; Mon, 31 Jul 2023 08:09:57 +0200 (CEST) Date: Mon, 31 Jul 2023 08:09:57 +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, hare@suse.de Subject: Re: [PATCH v2 1/4] blk-flush: flush_rq should inherit first_rq's cmd_flags Message-ID: <20230731060957.GA30409@lst.de> References: <20230725130102.3030032-1-chengming.zhou@linux.dev> <20230725130102.3030032-2-chengming.zhou@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230725130102.3030032-2-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 On Tue, Jul 25, 2023 at 09:00:59PM +0800, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > The cmd_flags in blk_kick_flush() should inherit the original request's > cmd_flags, but the current code looks buggy to me: Should it? I know the code is kinda trying to do it, but does it really make sense? Adding Hannes who originally added this inheritance and discussing the details below: > flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH; > - flush_rq->cmd_flags |= (flags & REQ_DRV) | (flags & REQ_FAILFAST_MASK); > + flush_rq->cmd_flags |= (first_rq->cmd_flags & REQ_DRV) | > + (first_rq->cmd_flags & REQ_FAILFAST_MASK); Two cases here: 1) REQ_FAILFAST_MASK: I don't think this is actually set on flush request currently, and even if it was applying it to the flush that serves more than a single originating command seems wrong to me. 2) REQ_DRV is only set by drivers that have seen a bio. For dm this is used as REQ_DM_POLL_LIST which should never be set for a flush/fua request. For nvme-mpath it is REQ_NVME_MPATH, which is set in the bio based driver and used for decision making in the I/O completion handler. So I guess this one actually does need to get passed through.