Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2559512pxb; Mon, 18 Apr 2022 03:24:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyJUvOhW0L5O32pcHJJK8OoWMfvEOxe4BlrHi2MwBE2VCQkAVqaOmFK5NsXgkh9czr4NFv X-Received: by 2002:a63:5b0d:0:b0:39c:c393:7e7f with SMTP id p13-20020a635b0d000000b0039cc3937e7fmr9793738pgb.16.1650277499643; Mon, 18 Apr 2022 03:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650277499; cv=none; d=google.com; s=arc-20160816; b=I3DRogUbrQdm9pIWSrTy8gj8Z1X6aKXeyRsFpRTyw4GA+DbVKN1l2Tuwoxgj37X2vD ejLKXIcrunCtY+YXXidLuhw2egxRWfFXEFt4mq4wrTgMNcnkkxZ42saxrWRXOTPNOwhQ 53CINpT0tq1baD4f7+J0co9TFWJWwbR/oNEa4nlQvcIONHOk8LGEDylCD1qdAQK7rcnL T3q2aUQuuIowmqgFO4dDf6QVgQMKiDGV7yEkhiSvlZFEeuDjkx6rLo6E0oqqB9r2NSmY WSFe1SZAecJuqTbjio2Bw/wkdBVvbWdndmzF1oComZ3uxj541MWpK2Fn/mEv22KKoE1v hIlw== 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:user-agent:mime-version :date:message-id:dkim-signature; bh=yXcY2sLxKmu9+uc8znQAcPD2dNxuNr8ZbO+FOstkiZI=; b=pD24ARvP0hEmyWpODFvrHwiIzz4jAptWKNgZ4VgTJ5ek3WoXgI7aWfV6ZkshHu7Kjk gkI4OWSL4uDgBhUw5Cp7OfmeYrt+uSTIT1U43ZYKRVVTWbh0QT5YEVVegRGPmi3e7Ujf V1FqoNQvB6PRkb7KqWXCvVqtpkOnobC/Lm5hgKzICw+wghBrj9F4A9y52m885KUVZJiz XSjtDy8N7gazvQvqsjRXrk4u9dd9ySI6WWp1pizl7k0L3dWGlcmh08+HgyuCIbuUT5vH n6Zje4RdAByTkRtpyQYyuqyXZUUWXU+gr1XZJxJSAIMQ14TPo0IRyBNiVGl0xsF5NFGR P7AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=jsUPT3YH; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 s194-20020a6377cb000000b003aa05e1e737si1974761pgc.384.2022.04.18.03.24.45; Mon, 18 Apr 2022 03:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=jsUPT3YH; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbiDQBCM (ORCPT + 99 others); Sat, 16 Apr 2022 21:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232002AbiDQBCL (ORCPT ); Sat, 16 Apr 2022 21:02:11 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D88935854 for ; Sat, 16 Apr 2022 17:59:37 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 125so12861860pgc.11 for ; Sat, 16 Apr 2022 17:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=yXcY2sLxKmu9+uc8znQAcPD2dNxuNr8ZbO+FOstkiZI=; b=jsUPT3YHo4/cYIAmgZIAnSlYKI0nc959ufJajYfMof9OwJfk20C6Jj4MCQxOoFVfzd 8CZITImUA0JUL0rrsbN+Q1jNPdwfbDzbpEAwuMbYmWzUDWqN1LlxTMxKdr7wiTart807 lVYSEsSYCvnqEcNF4dIvrrVs1ZnilrXJQq3BpTVlfaWyUg2/iYsX4teP+q2rubL0kyQ5 9eA1WHgD3af7B0FsT02HiHg8qTUY1m/N2ZSDXv1ZSbiE2eGhS1U75MedrZWG0VbqDCIk 86ZiAmZ+hqm6VgzTsJ6EyhJsfsG2O+zSwYSBGtFzwmVvR8ykckMNH1pUvI6/JhYqMXJc cAKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=yXcY2sLxKmu9+uc8znQAcPD2dNxuNr8ZbO+FOstkiZI=; b=gaSQqeTy3MQv80fBXcZ+o0Eg9il1qb0ysqjs+Clw5s8UsLt+YFdxbcGzp7Yq6iUZSX QeS/Yn4fbUXroW0b2siY3AkK8fbEgYFZCXYE6XJc8JxQPpJxSNzmojh7nE52Jy/6fNDx CM2OApSUj7L2N4LrjPzH6fVtVbz4BdrOtQPP9gUbiPBq+8bbo2lQrucc7GEVfhHDRaXO Omc9rxjmOTrpni3R8SaBfPTYy6cAJjLXY+WsIEf5oRc3KmNQUSjLDH+WodLnaV1+Q2gH iLfIgstuJzsnl8okwQh8999wqVqkN+z5xyfsfMaBTiVhi9DqrrdfywMlEaYHJpl4weRk mT2g== X-Gm-Message-State: AOAM532PoUhX1jbw3PY03d3yd/W7vAl+HTDE6aPIgGpjWkqKrf4HdvWO SuNyjVo1LeKZANn7193bObLSDw== X-Received: by 2002:a05:6a00:2186:b0:4f7:5544:1cc9 with SMTP id h6-20020a056a00218600b004f755441cc9mr5454910pfi.62.1650157176951; Sat, 16 Apr 2022 17:59:36 -0700 (PDT) Received: from [192.168.1.100] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id n12-20020a17090a670c00b001cbb7fdb9e4sm12697070pjj.53.2022.04.16.17.59.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Apr 2022 17:59:35 -0700 (PDT) Message-ID: <7ae1f26a-cd09-85ff-2f4c-9e80af41ce66@kernel.dk> Date: Sat, 16 Apr 2022 18:59:34 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: loop: it looks like REQ_OP_FLUSH could return before IO completion. Content-Language: en-US To: Eric Wheeler , Christoph Hellwig Cc: Ming Lei , linux-block@vger.kernel.org, linux-ext4@vger.kernel.org References: <5b3cb173-484e-db3-8224-911a324de7dd@ewheeler.net> <2815ce9-85f-7b56-be3f-7835eb9bb2c6@ewheeler.net> From: Jens Axboe In-Reply-To: <2815ce9-85f-7b56-be3f-7835eb9bb2c6@ewheeler.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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-ext4@vger.kernel.org On 4/16/22 2:05 PM, Eric Wheeler wrote: > On Fri, 15 Apr 2022, Christoph Hellwig wrote: >> On Fri, Apr 15, 2022 at 10:29:34PM +0800, Ming Lei wrote: >>> If ext4 expects the following order, it is ext4's responsibility to >>> maintain the order, and block layer may re-order all these IOs at will, >>> so do not expect IOs are issued to device in submission order >> >> Yes, and it has been so since REQ_FLUSH (which later became >> REQ_OP_FLUSH) replaced REQ_BARRIER 12 years ago: >> >> commit 28e7d1845216538303bb95d679d8fd4de50e2f1a >> Author: Tejun Heo >> Date: Fri Sep 3 11:56:16 2010 +0200 >> >> block: drop barrier ordering by queue draining >> >> Filesystems will take all the responsibilities for ordering requests >> around commit writes and will only indicate how the commit writes >> themselves should be handled by block layers. This patch drops >> barrier ordering by queue draining from block layer. > > Thanks Christoph. I think this answers my original question, too. > > You may have already answered this implicitly above. If you would be so > kind as to confirm my or correct my understanding with a few more > questions: > > 1. Is the only way for a filesystem to know if one IO completed before a > second IO to track the first IO's completion and submit the second IO > when the first IO's completes (eg a journal commit followed by the > subsequent metadata update)? If not, then what block-layer mechanism > should be used? You either need to have a callback or wait on the IO, there's no other way. > 2. Are there any IO ordering flags or mechanisms in the block layer at > this point---or---is it simply that all IOs entering the block layer > can always be re-ordered before reaching the media? No, no ordering flags are provided for this kind of use case. Any IO can be reordered, hence the only reliable solution is to ensure the previous have completed. -- Jens Axboe