Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4875330rwb; Tue, 20 Sep 2022 23:04:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZFdOP4BnFPlfpWq+eJiwjO9HG/0NngFLmaJEmnbgZcwUelq/10OKS9rpbX2Hsi2omDhYv X-Received: by 2002:a17:906:8459:b0:781:c9c3:b6fe with SMTP id e25-20020a170906845900b00781c9c3b6femr4975494ejy.37.1663740290433; Tue, 20 Sep 2022 23:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663740290; cv=none; d=google.com; s=arc-20160816; b=IB9jR9jf2pUqPdmF25fweag2PzNP9HhcspR8An/ayV9Gjdgx4WxoutiwQdqFVoLfv9 PyhbeBFpYfVnFpuB2q6+Y2jD8i7ijrBm05762OGeFhymSSMEphFuAfFwhn+FMds6Ns+z zYFQTFUTdWb7jlcLVfEz4sX5wXqqdyH/bQM05AnhSXyXSOMWE9oodv7h7awDN8kR3h/J PNiLc10Tvcb6VBIc+sB16ArerW/ITDjPa3yMeONvN0cK0yFjuNi/LNXFNAfVK+q58B0I 7t7T7HtCUl+eQ9cQNGjWK6J8MlTZ4IdJJNcwobHHUUMFWkw1QImBlCVh0gDK27FIyO/C GUUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=O+/FFDzqjGUa/uvDMSfAuiQjEkg5o9+lgPvGbc+n8wE=; b=GZu6TJOREfJBPVKtnorxMYRtJ8lKHwbDtvIx5LN5pFihTiL3zRhB93JFjk1173IzDW rCFMsltEUgsV1MaSdCwjbPgW8aF/I7Vyz0qdiJl+R6I8/bXUgpqV/YRlNQDSl9qWXUYx QtiohDZbaT2U0bAJArzPFtyHKWzgBBoIQ9BG5OdT9+8zkecCdTe0UOO7ennLjqd5CJwE NgVg4TZamgGUlwdb589XUWteqdRyMYLebHq3xYiCJJbbAVBtHt15sEjE9u4u/l2NPDPQ VNUWUCEs1iHhBXt8OkF3GFBf7OW44Ao3Duc6ZqhMV6r/wXmfXMENpDLvEjSBriJjcJV3 kifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M2HNg17G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho43-20020a1709070eab00b007821dbc5c0fsi365706ejc.439.2022.09.20.23.04.11; Tue, 20 Sep 2022 23:04:50 -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=@chromium.org header.s=google header.b=M2HNg17G; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbiIUFyu (ORCPT + 99 others); Wed, 21 Sep 2022 01:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiIUFys (ORCPT ); Wed, 21 Sep 2022 01:54:48 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 756B0DFEA for ; Tue, 20 Sep 2022 22:54:45 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id lc7so11311913ejb.0 for ; Tue, 20 Sep 2022 22:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=O+/FFDzqjGUa/uvDMSfAuiQjEkg5o9+lgPvGbc+n8wE=; b=M2HNg17GHPWM6YaoxXWHCj0Bj4Qcb3SFiebct60i4Kq2DeqFUCVSkSFeGDa1eQr76o QAj9qXjArpAvj6pZoapjSa8fvl8Ybj74urvoPRvvb8029qo35RLoAiKXpoM02YxOoaPP SEPdHtwtTdLozFOWHQQfD0FaI1vBycLifzNug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=O+/FFDzqjGUa/uvDMSfAuiQjEkg5o9+lgPvGbc+n8wE=; b=ypVnpKokElOyMB1NpWDRXnnhQl6Yvrkq0bxNoIdWoMFHiQRS8ZRZMzP21FunTLW+ov 1ihjMpexUhx4q9OnXcdn9hf0yoWgCMuyhN2gIyxPaJ7jAo9Kirs6gpz+AD7TZqIpZsNn IbDeNjrP+Yt65RAywgU9lpyaBdAIzMBqAmJ8jQVOttdoWqvZ2klA7+UAITH7FbGoJ6Ko gfrMw87+Y0T0SMj6jwt8ozYWISYI2gdev5n/5ZUEMbTbZD2i2DNDHwsdhECBW3EFBlKD cvgldXMWYMaiwlwHIYjB93jI1WVuMHL2prryhfrKSN5Cj5Xbx5vyrHVzzdG1hc/JLIID 0e9g== X-Gm-Message-State: ACrzQf07rG6YU4DLPp96aD6Cl8Bfr16u4591j0aLqyOq765VZ+PLMoPN gmmfACJ6UFWjV4UaY8ijNYCVWYgB+I37iNF/gNj+7Q== X-Received: by 2002:a17:907:7289:b0:780:2017:3898 with SMTP id dt9-20020a170907728900b0078020173898mr19775359ejc.276.1663739683574; Tue, 20 Sep 2022 22:54:43 -0700 (PDT) MIME-Version: 1.0 References: <20220915164826.1396245-1-sarthakkukreti@google.com> <20220915164826.1396245-5-sarthakkukreti@google.com> In-Reply-To: From: Sarthak Kukreti Date: Tue, 20 Sep 2022 22:54:32 -0700 Message-ID: Subject: Re: [PATCH RFC 4/8] fs: Introduce FALLOC_FL_PROVISION To: Christoph Hellwig Cc: dm-devel@redhat.com, linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Jens Axboe , "Michael S . Tsirkin" , Jason Wang , Paolo Bonzini , Stefan Hajnoczi , Alasdair Kergon , Mike Snitzer , "Theodore Ts'o" , Andreas Dilger , Bart Van Assche , Daniil Lunev , Evan Green , Gwendal Grignou Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Tue, Sep 20, 2022 at 12:49 AM Christoph Hellwig wrote: > > On Thu, Sep 15, 2022 at 09:48:22AM -0700, Sarthak Kukreti wrote: > > From: Sarthak Kukreti > > > > FALLOC_FL_PROVISION is a new fallocate() allocation mode that > > sends a hint to (supported) thinly provisioned block devices to > > allocate space for the given range of sectors via REQ_OP_PROVISION. > > So, how does that "provisioning" actually work in todays world where > storage is usually doing out of place writes in one or more layers, > including the flash storage everyone is using. Does it give you one > write? And unlimited number? Some undecided number inbetween? Apologies, the patchset was a bit short on describing the semantics so I'll expand more in the next revision; I'd say that it's the minimum of regular mode fallocate() guarantees at each allocation layer. For example, the guarantees from a contrived storage stack like (left to right is bottom to top): [ mmc0blkp1 | ext4(1) | sparse file | loop | dm-thinp | dm-thin | ext4(2) ] would be predicated on the guarantees of fallocate() per allocation layer; if ext4(1) was replaced by a filesystem that did not support fallocate(), then there would be no guarantee that a write to a file on ext4(2) succeeds. For dm-thinp, in the current implementation, the provision request allocates blocks for the range specified and adds the mapping to the thinpool metadata. All subsequent writes are to the same block, so you'll be able to write to the same block inifinitely. Brian mentioned this above, one case it doesn't cover is if provision is called on a shared block, but the natural extension would be to allocate and assign a new block and copy the contents of the shared block (kind of like copy-on-provision). [reflowed] > How is it affected by write zeroes to that range or a discard? The current semantics of discards for dm-thinp/ext4/sparse files will apply as they do today; discards will unmap the dm-thin block/free the file extent. Write zeroes is more interesting; dm-thinp will treat the command as usual. ext4_zero_range will mark the extents as unwritten, so essentially if a user did provision + write to a block, write zeros to the block would essentially leave it in the original provisioned state, but ext4 would now show the contents of the block as zero on the next read. I think, similar to above, the semantics of a request will depend on each layer that it passes through. Best Sarthak