Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp450810rdg; Tue, 10 Oct 2023 15:43:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFV1SbHUuIf+RJ26KFF3L6e8N24nqI4Uu3P9kpXOhIDtpr1rsFB24UyhxHB2G2ThkShM7D2 X-Received: by 2002:a17:902:dacd:b0:1c0:c174:3695 with SMTP id q13-20020a170902dacd00b001c0c1743695mr19353902plx.13.1696977815106; Tue, 10 Oct 2023 15:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696977815; cv=none; d=google.com; s=arc-20160816; b=srt/LG4LfZ7qQWeFbNAWuDfD5aSL1zcWRhcwlM1YP8QoD1zavk7/VBYBDHDOjMXxwp TtymbDZgpTQy/SUuHEii/4EFd3p5Xhw4WUQ5vVjGj4OzQsy7iuvcHFfVePbRm6JC6qt2 MUwEaWB4+X5zGgB9UIq4Ul5Hlj7w62/WTcKn0/JUp4peUdc2h6TL3qq4Aoo4LjPRNbkZ QFtUTgT1idHMyHVKclSAVydzwgOl6NBKXEjyn9Fa1sDPV7ZrQ6p9j4vOITNqB4CYl0r+ 2cZi2kfHWIx2PvDoa5ggiX1KgxkkNvhtwU/U21OP5oT+GUAPseMBNVAChmhV/KuC0YH2 w45Q== 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=626B9wgJ8h02KW46+tnnnyuQPSu/ZwIJyUI7faTL3rc=; fh=kHdET8ANSHOvdhl7O7u4JvI2u24RPj49U7ZAbILSPj4=; b=NLyR7+UaHvkdbS+XlCoDJv/aT9rez0+cKRfNduu5LXB7AJ3PuKwJPiab9vWZTzll9i 92WCu0zojcv60bEZHqnvQG22aoqEotGJtANRT8jGhOsBDdvJebdDAb0KurRHqMuq183d vERUlfcfsEWny6JA1mebNIH0Kz/KsucZUgTA12R+rDuMZBOXUqhAnhkBuvTj1zx8YmBY EijgEty0dPk9f7B6x3Llia3/8snialSPDBICuApkYtFzA0NhWk3Obo/Vp/dI1ga3QUyk KlBBN/hGOqpdsVc7EhUYP2LqxIB8Trsw4KHVsTaHKf0CqLMf7DT9kNaXDMR8Z0rudz34 +yBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jfbUoSbD; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id u12-20020a170902e5cc00b001c563263222si14066930plf.376.2023.10.10.15.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:43:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jfbUoSbD; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A41B480DA331; Tue, 10 Oct 2023 15:43:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234457AbjJJWn2 (ORCPT + 99 others); Tue, 10 Oct 2023 18:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbjJJWn1 (ORCPT ); Tue, 10 Oct 2023 18:43:27 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7181B8 for ; Tue, 10 Oct 2023 15:43:23 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9ad810be221so1048544166b.2 for ; Tue, 10 Oct 2023 15:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696977802; x=1697582602; darn=vger.kernel.org; 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=626B9wgJ8h02KW46+tnnnyuQPSu/ZwIJyUI7faTL3rc=; b=jfbUoSbDgKMgDfWBhgY0uZVFLrf7vN6BIPVrJbT81JkvehIVroIwvie0YJraSysqpl 3V9r9SkFARN534PaxtNR+OoeAsaS1iiNfNvJmMY0YJ3wI5Wq54Dh2j3TZznGHcXx2lLf coqCIn74F6NuRn5GZX2skCwJYgk9pMmDLoLGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696977802; x=1697582602; 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=626B9wgJ8h02KW46+tnnnyuQPSu/ZwIJyUI7faTL3rc=; b=t0ZFbySqPuXa3Czkyq/BvbMSm/Xuct7eA/pwRaGa6RrW8rDvimXQOjbfFkpIMboN+y IWGCprJEFfMRxjb3iNpMW+t1KzEQA1Qjde3SJKRdWRWWStGfv1Yq65a5lCIqAaT7v04D P61ard0/H+mvPVNaquZbraDwrmiQneQza7hH5GvL5iIopEz+ATnpOh38KiQKEU+8Llmy ywPvp9GJiJi9A/2cRULYHld2Qufa+AvbNDhoGhcUd13e7FvpK7F5Now1hGtHbPmBAWRv BAatyxNfNBy42ywKZiMuHucCDmw/20kVbHBA+USsxvtYxYKcGDPUTPC3f5rVobDgRxtI xLGw== X-Gm-Message-State: AOJu0Yw6piUXzpdclHVl89Uv7y//Zf2R6Xk6YUWudmrMKvWSXJm6ECvm YHgtMvdLjcq6wvihRcqT8FRzyqubK2g+avgMEtW7Hg== X-Received: by 2002:a17:907:780d:b0:9b6:4df9:e5b5 with SMTP id la13-20020a170907780d00b009b64df9e5b5mr17511207ejc.61.1696977802200; Tue, 10 Oct 2023 15:43:22 -0700 (PDT) MIME-Version: 1.0 References: <20231007012817.3052558-1-sarthakkukreti@chromium.org> <20231007012817.3052558-4-sarthakkukreti@chromium.org> In-Reply-To: From: Sarthak Kukreti Date: Tue, 10 Oct 2023 15:43:10 -0700 Message-ID: Subject: Re: [PATCH v8 3/5] loop: Add support for provision requests To: Dave Chinner Cc: 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 , Alasdair Kergon , Mike Snitzer , Christoph Hellwig , Brian Foster , "Theodore Ts'o" , Andreas Dilger , Bart Van Assche , "Darrick J. Wong" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 15:43:31 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 8, 2023 at 4:37=E2=80=AFPM Dave Chinner w= rote: > > On Fri, Oct 06, 2023 at 06:28:15PM -0700, Sarthak Kukreti wrote: > > Add support for provision requests to loopback devices. > > Loop devices will configure provision support based on > > whether the underlying block device/file can support > > the provision request and upon receiving a provision bio, > > will map it to the backing device/storage. For loop devices > > over files, a REQ_OP_PROVISION request will translate to > > an fallocate mode 0 call on the backing file. > > > > Signed-off-by: Sarthak Kukreti > > Signed-off-by: Mike Snitzer > > > Hmmmm. > > This doesn't actually implement the required semantics of > REQ_PROVISION. Yes, it passes the command to the filesystem > fallocate() implementation, but fallocate() at the filesystem level > does not have the same semantics as REQ_PROVISION. > > i.e. at the filesystem level, fallocate() only guarantees the next > write to the provisioned range will succeed without ENOSPC, it does > not guarantee *every* write to the range will succeed without > ENOSPC. If someone clones the loop file while it is in use (i.e. > snapshots it via cp --reflink) then all guarantees that the next > write to a provisioned LBA range will succeed without ENOSPC are > voided. > > So while this will work for basic testing that the filesystem is > issuing REQ_PROVISION based IO correctly, it can't actually be used > for hosting production filesystems that need full REQ_PROVISION > guarantees when the loop device backing file is independently > shapshotted via FICLONE.... > > At minimuim, this set of implementation constraints needs tobe > documented somewhere... > Fair point. I wanted to have a separate fallocate() mode (FALLOC_FL_PROVISION) in the earlier series of the patchset so that we can distinguish between a provision request and a regular fallocate() call; I dropped it from the series after feedback that the default case should suffice. But this might be one of the cases where we need an explicit intent that we want to provision space. Given a separate FALLOC_FL_PROVISION mode in the scenario you mentioned, the filesystem could copy previously 'provisioned' blocks to new blocks (which implicitly provisions them) or reserve blocks for use (and passing through REQ_OP_PROVISION below). That also means that the filesystem should track 'provisioned' blocks and take appropriate actions to ensure the provisioning guarantees. For filesystems without copy-on-write semantics (eg. ext4), REQ_OP_PROVISION should still be equivalent to mode =3D=3D 0. For now, I'll add the details to the commit message and the loop driver code (side note: should there be device documentation on the loop device driver?). WDYT? Best Sarthak > -Dave. > -- > Dave Chinner > david@fromorbit.com