Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp57467rwr; Wed, 19 Apr 2023 17:55:48 -0700 (PDT) X-Google-Smtp-Source: AKy350bR718y2YOR5a4Rnvt3URkd4LQ6FMtch0rDAMhfV3LuvAUPX+ZHChzW32oumS8ja2LvDzrs X-Received: by 2002:a17:903:22c4:b0:1a1:d70f:7114 with SMTP id y4-20020a17090322c400b001a1d70f7114mr7985370plg.14.1681952148250; Wed, 19 Apr 2023 17:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681952148; cv=none; d=google.com; s=arc-20160816; b=av+rROZml3yysUOHwX2i3wpKTflArKWFElt0CMrtFinhCEQA1P3GfB35H8o7UyiXUR hUcRybt7eRpoS2kMhiEewpT1MP7td2m6BsQit+mXIa8Tka7VAn7TQk8PNUvkriq1lbSq eU1dC7cWjKkb4LxHooAo2IiHVpJPokpyRp0ghgQhZjTx5sJ66qLFbI5+8vKIKgc0GElI nhhjQSSKl/3Qiv2c1wfsBZtyoni0osAvbLLlzDJD3gEK3psUmswZ5OatRadPt9W0E3Wq B6DP5IvhGxJ0LjP6OSNswwpK2k3wUsXtpiJRgQ/PfOqfB0pYO8DY/l4WCHerhd3nU4n7 BP2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CEZZksfYsGWpaWEP90hGUd/QDkimEQeeLBa7ojWXyLA=; b=cW4N0f0e0JrK7EsXKRdNgMcHBmWibTsJJTcafeH+QdOG3D9vYFt3ygzA8P0/AXiRDx KbEYYiTJ20z6i599rFEj7saSvsH1DOuPtuTISJ3uQdF3xG0Sv0BFMvBH47PWhxjZLDAU xdS60slUxat1/AyH4oDonHyGyX94iI3Mw/mK/TkiFMV5LxhQmKulUebdAWe1rqw+LbXq 2X6nbwB7XYzPDNGu7ihgKYA9VQSVpfT2ajX0LBzNWaZnBm+8kLVn65dIgkFLWHQ3xvD6 3x9IzksAmakyAkH7UOYtu3x7MgEEz9e5N0e7CGVpWy1Eozv4lXfb+uGGdT4TX2xY+G61 +55w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mHIqqwSc; 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 kb14-20020a170903338e00b001a8096ef2bfsi275964plb.34.2023.04.19.17.55.34; Wed, 19 Apr 2023 17:55:48 -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=mHIqqwSc; 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 S231693AbjDTAyO (ORCPT + 99 others); Wed, 19 Apr 2023 20:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbjDTAyN (ORCPT ); Wed, 19 Apr 2023 20:54:13 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E3D35B1 for ; Wed, 19 Apr 2023 17:54:11 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-94a34a0b9e2so27350066b.1 for ; Wed, 19 Apr 2023 17:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681952049; x=1684544049; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CEZZksfYsGWpaWEP90hGUd/QDkimEQeeLBa7ojWXyLA=; b=mHIqqwSc25lfW3PRtDHaxw4X6N2TnD+fDXQQXVKqR+Y4Ni7XFmZuF2Anv4LTKQqX8D +UVwoeT1jGo7BVoinlsnl4aqpck+17bBw8kNVcn9qz+AZJbYuvkShd+gKGb13fm9VE2o MxLZ0mnclVkF8kl6G805ooDsknwHf00fYwQFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681952049; x=1684544049; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CEZZksfYsGWpaWEP90hGUd/QDkimEQeeLBa7ojWXyLA=; b=gSvIiRmQBzxCGiuUfdxBWGOBxkAdWgV8PPAeH3BRE6noe8VFfrmvNphLrKsNKtlXIk oANV0dcnjIaw7JFAXinXpNrIcT9AAByU22fUI3nvLmVUvTTREH97euSIdG7Fa3hhLLwV wLkrCLQlM38T65hVz6Qx7g0m4Uif+406DcBLuIM/uk8WTkNIlKkcmYcH5U+J79HmqPnm mNTH3N95Rtc1r3SN3wtKN9P5dHEwADLhZyJsTezGBKbclg613hdiGlg49yX1Y/ok4ZIu typ7RhFYR8xgsV7Sediz47oE1vrcOu4QOehzBUXO+nzg5vTDQY66VSXtOuVbGvoZWdEi N6Xw== X-Gm-Message-State: AAQBX9ehzSNbGb5WIvhdGjlYjAhcAhjFC/fYqdHauFGMiu+nTOOlhUh3 f95/GIn5tjikKnnybV8MLk/86rriMoNEFOBJj17XMqF10koTHXgNoYo= X-Received: by 2002:a05:6402:406:b0:504:9ae7:f73b with SMTP id q6-20020a056402040600b005049ae7f73bmr7162959edv.2.1681952049439; Wed, 19 Apr 2023 17:54:09 -0700 (PDT) MIME-Version: 1.0 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> <20230419232118.GL447837@dread.disaster.area> In-Reply-To: <20230419232118.GL447837@dread.disaster.area> From: Sarthak Kukreti Date: Wed, 19 Apr 2023 17:53:58 -0700 Message-ID: Subject: Re: [PATCH v4 1/4] block: Introduce provisioning primitives To: Dave Chinner Cc: "Darrick J. Wong" , Mike Snitzer , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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,T_SCC_BODY_TEXT_LINE 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 Wed, Apr 19, 2023 at 4:21=E2=80=AFPM Dave Chinner = wrote: > > 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 fla= g > > 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... > I added a separate commit[1] to fix this so that we only truncate_bdev_range() iff we are in a supported de-allocate mode call. Subsequently, the REQ_OP_PROVISION patch is a bit simpler when rebased on top. [1] https://www.spinics.net/lists/kernel/msg4765688.html Best Sarthak > -Dave. > -- > Dave Chinner > david@fromorbit.com