Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp983335rwr; Wed, 19 Apr 2023 16:36:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bHkLn7TB9MUh6PwV3/f1rmumIWRTTm/SUD1UA+e+YzDHuz4TySPIVGBcEqbSPE3OR4MbVk X-Received: by 2002:a17:902:d48b:b0:1a1:b3bb:cd5b with SMTP id c11-20020a170902d48b00b001a1b3bbcd5bmr8313967plg.62.1681947361324; Wed, 19 Apr 2023 16:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681947361; cv=none; d=google.com; s=arc-20160816; b=LhlMjv9g0qsZ9SstMqtWD+w3t/27XvFZJfXeZBtM/rt5tv6lq96Vd3m4WbUTP+nuPx P6gqv2dza8SCXugGJAupq1+Gt8HHFu+OnzZ5fqXOEEd9PdRW5PdHqG6C8jWm3QWyATDg 5S2ReDfuxPcKeUqt9F3Zsi4hhsMAMHOtQj3dimmoVF5DMigKDfkwxTatU7549TCWa4Q2 N8jOlOg1lXgy/HRY1J+5ehqB0CUP+1ZXbHkbWFOmJAvVaO7v6cbyuxd0fBoXwltxkR5L 6+eYysuwEnaLwmolXcbbqJAAuh3uSNnxESOoQb2PLXSpgWN3GMUZ96QAl2lXiPFyHOwx 8YvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=O4EzLlnke++OBfC+QU/8848E+9V2OKTR6syW6axwlV8=; b=CSuwFEuudU949q76rZ6pXHXIY/1wLNMzbQd1pz6pYnvpTw14QvsuGCe3rP/K/0cRu5 1fYLibnjRpVlecndBIwt4CepH1O8vm98S+5qaDph+NRdsnNKJIuc1lItXFhdFR7EsHAX IXR2kcmEYTV6muDHG3DsZenNGw/ZDE11hunyieG8+VtmbVQKTcrPnk/Cdy5dWlBlhEcl V2dpJ33HpApBpzq/8z7s06WLpi6RbmHbwUBIIxW1PmzeRLHQFq/LBsxSPtSIlYZrp1Eu fR/yyGbV1ANiywCOrOZGjBpp7E7aZxg5KOz9l6pOtHy4kXLvaoOKQNCsIFyXHVm3SFmS +KVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=1rSGerHk; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170902e5cb00b001a6559684a5si866plf.514.2023.04.19.16.35.42; Wed, 19 Apr 2023 16:36:01 -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=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=1rSGerHk; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbjDSXVY (ORCPT + 99 others); Wed, 19 Apr 2023 19:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjDSXVX (ORCPT ); Wed, 19 Apr 2023 19:21:23 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632F31BD6 for ; Wed, 19 Apr 2023 16:21:22 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-51b5490c6f0so310752a12.0 for ; Wed, 19 Apr 2023 16:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20221208.gappssmtp.com; s=20221208; t=1681946482; x=1684538482; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=O4EzLlnke++OBfC+QU/8848E+9V2OKTR6syW6axwlV8=; b=1rSGerHklr5JAXi27oI/uAKbIpnzmbhuAcqtkq9Ewpy+oxiEbVyn+NXg0Nte1Jz5gb Jddew7juj8EN4LNPm7rX/98XzjawOZWNBXgYRDT4svPbR6SgKWYB3DBdvEC6M5GMrfwT NVGwJGMv68WQml94zJmFq7eiIKhhHdqtvpReJGsxvaD7E+Q5v+/9MtrHrCKvxTmZ6EDY BasRW6aVsh4KPRIad1iWbms6wcLJVor1YOWpS9y4GmXYAKYprdaeppUQ33xbvQC/eBjL dLUjVVOrNBmfM3cIFzadvXJVlSI7PHUWmH/8OBSUCDMgpYod0Y/sBth54czPU5qQiJoJ NrDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681946482; x=1684538482; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=O4EzLlnke++OBfC+QU/8848E+9V2OKTR6syW6axwlV8=; b=BofKD7li6JC4pitpeLeRTYPWB38y21oavVumyVsdRjmvt+a/RXdsm1K+lV+CDwV6+d ZCOCh05Q57XBFNbDIJoB+ax/j6eWfdIgomwOE9tAX3YDD62cyoYhaRpX0pLXyQKIav5L 9n7qFsD+CorfVC8lxG+2jj1s7jeQxKDu+Hio5qzT0D5Xe2TAaHiPxhq2cLV1VcZyST0f ncJAduKylRzAPFmcM1UxtunqYjVDZHY8vLCP/eUwwnfM/Dq3uPH4O4+KR1EQGDpV96Ek 5yV6QJUHxVHGJfdfy3Z2de4k30kWqQ8MkeecwzUQrd+bNajAZDIcwy6MnuJivIUpWbXv 9x4w== X-Gm-Message-State: AAQBX9cHj4ve+RUM/EBM3JD8x9XEpp9Ngf8qvDZNFCixPNqSDO1x1z8b QfbMpaAi6PafP+jQwzYXgeYbtQ== X-Received: by 2002:a17:902:b089:b0:19d:611:2815 with SMTP id p9-20020a170902b08900b0019d06112815mr6659257plr.42.1681946481873; Wed, 19 Apr 2023 16:21:21 -0700 (PDT) Received: from dread.disaster.area (pa49-180-41-174.pa.nsw.optusnet.com.au. [49.180.41.174]) by smtp.gmail.com with ESMTPSA id ja13-20020a170902efcd00b0019682e27995sm6226725plb.223.2023.04.19.16.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 16:21:21 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1ppH70-005RJM-QK; Thu, 20 Apr 2023 09:21:18 +1000 Date: Thu, 20 Apr 2023 09:21:18 +1000 From: Dave Chinner To: "Darrick J. Wong" Cc: Mike Snitzer , Sarthak Kukreti , dm-devel@redhat.com, linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , Theodore Ts'o , "Michael S. Tsirkin" , Jason Wang , Bart Van Assche , Christoph Hellwig , Andreas Dilger , Daniil Lunev , Stefan Hajnoczi , Brian Foster , Alasdair Kergon Subject: Re: [PATCH v4 1/4] block: Introduce provisioning primitives Message-ID: <20230419232118.GL447837@dread.disaster.area> References: <20230414000219.92640-1-sarthakkukreti@chromium.org> <20230418221207.244685-1-sarthakkukreti@chromium.org> <20230418221207.244685-2-sarthakkukreti@chromium.org> <20230419153611.GE360885@frogsfrogsfrogs> <20230419172602.GE360881@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230419172602.GE360881@frogsfrogsfrogs> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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-kernel@vger.kernel.org On Wed, Apr 19, 2023 at 10:26:02AM -0700, Darrick J. Wong wrote: > On Wed, Apr 19, 2023 at 12:17:34PM -0400, Mike Snitzer wrote: > > (And obviously needs fixing independent of this patchset) > > > > Shouldn't mkfs first check that the underlying storage supports > > REQ_OP_PROVISION by verifying > > /sys/block//queue/provision_max_bytes exists and is not 0? > > (Just saying, we need to add new features more defensively.. you just > > made the case based on this scenario's implications alone) > > Not for fallocate -- for regular files, there's no way to check if the > filesystem actually supports the operation requested other than to try > it and see if it succeeds. We probably should've defined a DRY_RUN flag > for that purpose back when it was introduced. That ignores the fact that fallocate() was never intended to guarantee it will work in all contexts - it's an advisory interface at it's most basic level. If the call succeeds, then great, it does what is says on the box, but if it fails then it should have no visible effect on user data at all and the application still needs to perform whatever modification it needed done in some other way. IOWs, calling it one a block device without first checking if the block device supports that fallocate operation is exactly how it is supposed to be used. If the kernel can't handle this gracefully without corrupting data, then that's a kernel bug and not an application problem. > For fallocate calls to block devices, yes, the program can check the > queue limits in sysfs if fstat says the supplied path is a block device, > but I don't know that most programs are that thorough. The fallocate(1) > CLI program does not check. Right. fallocate() was intended to just do the right thing without the application having to jump thrown an unknown number of hoops to determine if fallocate() can be used or not in the context it is executing in. The kernel implementation is supposed to abstract all that context-dependent behaviour away from the application; all the application has to do is implement the fallocate() fast path and a single generic "do the right thing the slow way" fallback when the fallocate() method it called is not supported... -Dave. -- Dave Chinner david@fromorbit.com