Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp450679rdg; Tue, 10 Oct 2023 15:43:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM9AqDrzDMQtHJCB0a3WVclra+Q5jeyCurwFkN2Oa9w6HTJ79y5AXwBXaD6aaFcNqenJ55 X-Received: by 2002:a9d:7c8b:0:b0:6c4:f25f:612f with SMTP id q11-20020a9d7c8b000000b006c4f25f612fmr18741071otn.28.1696977793355; Tue, 10 Oct 2023 15:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696977793; cv=none; d=google.com; s=arc-20160816; b=CwB3bsMRvAwAa+VGtcRAg6ABQ5qCZ8195ZOM+bfCNoReNucWnpGLnxzmWtoby24mrA lBNISkVIKEekac8ncdZxMVhOWM3Lo5A2NrE0T9qHOen/Sc40K5E5i6AjTnOYR3kxHKar j2Y96tE+m+zTn9GnNrJ8ywbUWvcYczz4G9dALBFpDRif+LZc5oaWmCZxHM+H8fIGjcWZ 9Ih7j8/Zx2t5d3mfk3cElXXAmfj3a1bmAnLMIfzlsRc/zCaot2IbUXLrDLwyL4tl6yPE jiUVnLgqW4/dFQOyI7jU7vuKnY8IzFqJumlYUFdKYhggw2tTK7f4MREzjP9ojx1Fe55o N/gw== 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=tb9bykOj2PFr0JPtI/2Jn1spETOn70fv/I2YmNILcfw=; fh=kHdET8ANSHOvdhl7O7u4JvI2u24RPj49U7ZAbILSPj4=; b=efplICbDUv4zHR1CCppikjCfuNY5GOTAW9KPdcQJewzZKMRZuI4AI1tcWVdvY53lqx 6k9scXOKetG0sylQGgF3G2MEtX7oatOLK3rQEBSh2zC2fVK3jBDFGs8sozhaMLBL752w XxrHzQECo07dLnHX+9AUewLX4J2q2E6jdXhl7mCI5kzSIv+kdel+0cOKMIHB8UYBhqVc pVbcvGqBQJVX3bFqRNXZswJ3KdCsXXhn1CpvUXlGYHENQ+LHudViNltc5OpT7CuZk4GH Ch+5I9etelo6NwqVlKJCPfMIAFrvKCo2yq/L3sKC05ORWpJJBo0id2Xno57WJj4F/q/K IcEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CvU9EPj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 33-20020a631861000000b0056603994af8si12553001pgy.666.2023.10.10.15.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 15:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CvU9EPj1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-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 morse.vger.email (Postfix) with ESMTP id 80BAE801B9A7; Tue, 10 Oct 2023 15:43:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343792AbjJJWm5 (ORCPT + 99 others); Tue, 10 Oct 2023 18:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbjJJWmz (ORCPT ); Tue, 10 Oct 2023 18:42:55 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0330799 for ; Tue, 10 Oct 2023 15:42:53 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9a9f139cd94so1033980566b.2 for ; Tue, 10 Oct 2023 15:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696977771; x=1697582571; 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=tb9bykOj2PFr0JPtI/2Jn1spETOn70fv/I2YmNILcfw=; b=CvU9EPj1lUJQyOfAGhYeGOjHZqZh94H8624ZCxtj/g4utxU07Pzp9HavSi9mU6cImZ p8KwpzKyS38reVcjErdfotvGWGeX62qduqXmHaCwNdXi9MaP0w2ZdfAcvbDL/66LhvoA Rnqj9gBEYjcg319GJ4vHBeHraFRVuGXeDWdU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696977771; x=1697582571; 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=tb9bykOj2PFr0JPtI/2Jn1spETOn70fv/I2YmNILcfw=; b=ty/Wc+UWHA1me9i6dmGm/AQLrs3NErEICkYgr6dEiQQEoxr80cgj2DnrDGZl/86M29 /dGgFc+4d8Kf3JpAExHWsQyWlr7zIMmd2YsXR7ketJBjj0v4/TV4iOVu4x7yZeAyzBgL ZIk/ihblgUGjbArtp098D96RlDnARGGlMMe29yCv56SBSXsu/ZcTjJNpo3Qqhfv1kiJu myMGtyjxwz5Gd2d76PBCYNUW4bmZPas3x0XafF6jtnbeiKx5H9bEXUpW69PIG5Y6J7Vt v/oDTmbBTIHjih8KRNTa6gsVj95k+Hh3/+t+tQYnrPEu3fDQ4AKe3zrgK5XjiT2orPkH mt0g== X-Gm-Message-State: AOJu0YyFjlC7FjMuuREAxr3sxAeGdPMptvj8Jzk/IjaPz6uaVZGEZFXR 16+uoQKoybhYaXnZqrEFDAeTZrz+FyY2apT89hftDg== X-Received: by 2002:a17:906:9a:b0:9b2:b149:b818 with SMTP id 26-20020a170906009a00b009b2b149b818mr17960595ejc.70.1696977771190; Tue, 10 Oct 2023 15:42:51 -0700 (PDT) MIME-Version: 1.0 References: <20231007012817.3052558-1-sarthakkukreti@chromium.org> <20231007012817.3052558-6-sarthakkukreti@chromium.org> In-Reply-To: From: Sarthak Kukreti Date: Tue, 10 Oct 2023 15:42:39 -0700 Message-ID: Subject: Re: [PATCH v8 5/5] block: Pass unshare intent via REQ_OP_PROVISION 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 15:43:09 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 8, 2023 at 4:27=E2=80=AFPM Dave Chinner w= rote: > > On Fri, Oct 06, 2023 at 06:28:17PM -0700, Sarthak Kukreti wrote: > > Allow REQ_OP_PROVISION to pass in an extra REQ_UNSHARE bit to > > annotate unshare requests to underlying layers. Layers that support > > FALLOC_FL_UNSHARE will be able to use this as an indicator of which > > fallocate() mode to use. > > > > Suggested-by: Darrick J. Wong > > Signed-off-by: Sarthak Kukreti > > --- > > block/blk-lib.c | 6 +++++- > > block/fops.c | 6 ++++-- > > drivers/block/loop.c | 35 +++++++++++++++++++++++++++++------ > > include/linux/blk_types.h | 3 +++ > > include/linux/blkdev.h | 3 ++- > > 5 files changed, 43 insertions(+), 10 deletions(-) > > I have no idea how filesystems (or even userspace applications, for > that matter) are supposed to use this - they have no idea if the > underlying block device has shared blocks for LBA ranges it already > has allocated and provisioned. IOWs, I don't know waht the semantics > of this function is, it is not documented anywhere, and there is no > use case present that tells me how it might get used. > > Yes, unshare at the file level means the filesystem tries to break > internal data extent sharing, but if the block layers or backing > devices are doing deduplication and sharing unknown to the > application or filesystem, how do they ever know that this operation > might need to be performed? In what cases do we need to be able to > unshare block device ranges, and how is that different to the > guarantees that REQ_PROVISION is already supposed to give for > provisioned ranges that are then subsequently shared by the block > device (e.g. by snapshots)? > > Also, from an API perspective, this is an "unshare" data operation, > not a "provision" operation. Hence I'd suggest that the API should > be blkdev_issue_unshare() rather than optional behaviour to > _provision() which - before this patch - had clear and well defined > meaning.... > Fair points, the intent from the conversation with Darrick was the addition of support for FALLOC_FL_UNSHARE_RANGE in patch 2 of v4 (originally suggested by Brian Forster in [1]): if we allow fallocate(UNSHARE_RANGE) on a loop device (ex. for creating a snapshot, similar in nature to the FICLONE example you mentioned on the loop patch), we'd (ideally) want to pass it through to the underlying layers and let them figure out what to do with it. But it is only for situations where we are explicitly know what the underlying layers are and what's the mecha I agree though that it clouds the API a bit and I don't think it necessarily needs to be a part of the initial patch series: for now, I propose keeping just mode zero (and FALLOC_FL_KEEP_SIZE) handling in the block series patch and drop this patch for now. WDYT? Best Sarthak [1] https://patchwork.ozlabs.org/project/linux-ext4/patch/20230414000219.92= 640-2-sarthakkukreti@chromium.org/#3097746 > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com