Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10630635rwr; Fri, 12 May 2023 10:35:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5M13CsqUjMKL17eP/MsAFDH3z52V9t0c/qqmWygrOBe2LxNtCX/vDYuQYOCxdsGiggRe0H X-Received: by 2002:a05:6a00:198a:b0:641:39cb:1716 with SMTP id d10-20020a056a00198a00b0064139cb1716mr33289385pfl.20.1683912920113; Fri, 12 May 2023 10:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683912920; cv=none; d=google.com; s=arc-20160816; b=hA50PfA9tMIsopi6zXkAhgYEskAMXKq6rCI1BhXwiSgtVNo4lDR7YSCemZqu5mCAPQ j27ho/W3QnKJoNmiJs7+YaZWFqf6MWdNqPktgb7qro3DF66IRKzCQ0n0Zn5DREp/dQPW S2+RGOR4b6VBXc09bX2aLVp7KyPMbzXew9VK7T5wiP6BKZszz/nFXyQzzv1FuNCU+tqc CEysYNKucysboiDBLWmeETkKs1VINIl5l3EKzTasJ+yO7UO2wPguaKw7ADhTVMVxA1oh qJ/d3j5QdKtgd3nl+M5lPORlh3WMIgdLyJlBqWVlvih8xiGvic5iDPzJLSwXwONVHxWG rFKg== 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; bh=6V0M3WHsM/CbP7GPo2jgrowLKKxSm62sS3psQx8zXQg=; b=AQsHIH87ugmNo1K7GzD6BImWAwDCYjgX+7yk8Rom9jALMdzirMQlLr20qsJHDfEuM0 Iunz6Nh8Sn/uPfEIKOEENqy7GnUi1Zc0O2PMfafQZ9g6MTHB/TdOD8RKYcllaseNQV5/ FDvrh/uqohSp6tFBXKWxWIC73dqMhhAlk8gQ/PD2bxOtc9tVjv+JhA30Z7kL+7RYzMjo m7CQERGQ0JzybhFQ8hxBRpuW7/KH0LnXVfoG8rVP9T6k6kudOQm7MQKBfSodEHMnMZ83 FzaHdJhAA1N5S8gb+/TGV5iBSAqCrRYnDbq9pKjujQWKbe/TchcBF+RnN6sKQ+Y+tH3i KsmQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f144-20020a623896000000b00624eb57b45dsi489691pfa.74.2023.05.12.10.35.00; Fri, 12 May 2023 10:35:20 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236207AbjELRdb (ORCPT + 99 others); Fri, 12 May 2023 13:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236972AbjELRda (ORCPT ); Fri, 12 May 2023 13:33:30 -0400 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5746D195 for ; Fri, 12 May 2023 10:32:43 -0700 (PDT) Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-61b5b4df8baso80712166d6.1 for ; Fri, 12 May 2023 10:32:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683912762; x=1686504762; 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=6V0M3WHsM/CbP7GPo2jgrowLKKxSm62sS3psQx8zXQg=; b=BuKcSkNjcfhg9/tAF1guqCpTrsnyVNKL7JJIEbVD3OusNUaY5gOgoqaTIcasl+gKs0 XMAVjxBEELpMaRtOFUHD+LoLHFjb0ULofB3X6cbN8ryl08rlK1IDzJkfeg9h815wOJCo v00mWym0wOAN9mbSQv/olqBz4kInbr6tu6vxF1koB0hzN9GD8IV9DWMVxQg/23ertHSN St7sQcYw8QrpbbQuXznYRsj/Nfodq1/svIQvKWfyj8vtJV9HyqtIVck5as06k6WzdLBS pbvX3kqCWeyNYw+BdMFNRcS2xauTHUr2Uu3xbOrt7f4nJbdi6nDdCGLruuZTncnxFhq0 6Wcw== X-Gm-Message-State: AC+VfDzPoVoRHCAnvWxxWysvWON1EcNAinF14uA2W/c0yqGyjDkBo1MK 7tgICAfMZwckqWgr33RELPed X-Received: by 2002:ad4:5ae5:0:b0:621:1b1d:7dde with SMTP id c5-20020ad45ae5000000b006211b1d7ddemr38554895qvh.8.1683912762375; Fri, 12 May 2023 10:32:42 -0700 (PDT) Received: from localhost (pool-68-160-166-30.bstnma.fios.verizon.net. [68.160.166.30]) by smtp.gmail.com with ESMTPSA id h10-20020a0cf20a000000b0061b5c45f970sm3137246qvk.74.2023.05.12.10.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 10:32:41 -0700 (PDT) Date: Fri, 12 May 2023 13:32:40 -0400 From: Mike Snitzer To: Sarthak Kukreti 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 , Theodore Ts'o , "Michael S. Tsirkin" , "Darrick J. Wong" , Jason Wang , Bart Van Assche , Christoph Hellwig , Andreas Dilger , Stefan Hajnoczi , Brian Foster , Alasdair Kergon Subject: Re: [PATCH v6 4/5] dm-thin: Add REQ_OP_PROVISION support Message-ID: References: <20230420004850.297045-1-sarthakkukreti@chromium.org> <20230506062909.74601-1-sarthakkukreti@chromium.org> <20230506062909.74601-5-sarthakkukreti@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230506062909.74601-5-sarthakkukreti@chromium.org> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, May 06 2023 at 2:29P -0400, Sarthak Kukreti wrote: > dm-thinpool uses the provision request to provision > blocks for a dm-thin device. dm-thinpool currently does not > pass through REQ_OP_PROVISION to underlying devices. > > For shared blocks, provision requests will break sharing and copy the > contents of the entire block. Additionally, if 'skip_block_zeroing' > is not set, dm-thin will opt to zero out the entire range as a part > of provisioning. > > Signed-off-by: Sarthak Kukreti > --- > drivers/md/dm-thin.c | 70 +++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 66 insertions(+), 4 deletions(-) > > diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c > index 2b13c949bd72..3f94f53ac956 100644 > --- a/drivers/md/dm-thin.c > +++ b/drivers/md/dm-thin.c ... > @@ -4114,6 +4171,8 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) > * The pool uses the same discard limits as the underlying data > * device. DM core has already set this up. > */ > + > + limits->max_provision_sectors = pool->sectors_per_block; Just noticed that setting limits->max_provision_sectors needs to move above pool_io_hints code that sets up discards -- otherwise the early return from if (!pt->adjusted_pf.discard_enabled) will cause setting max_provision_sectors to be skipped. Here is a roll up of the fixes that need to be folded into this patch: diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 3f94f53ac956..90c8e36cb327 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -4151,6 +4151,8 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) blk_limits_io_opt(limits, pool->sectors_per_block << SECTOR_SHIFT); } + limits->max_provision_sectors = pool->sectors_per_block; + /* * pt->adjusted_pf is a staging area for the actual features to use. * They get transferred to the live pool in bind_control_target() @@ -4171,8 +4173,6 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) * The pool uses the same discard limits as the underlying data * device. DM core has already set this up. */ - - limits->max_provision_sectors = pool->sectors_per_block; } static struct target_type pool_target = { @@ -4349,6 +4349,7 @@ static int thin_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_provision_bios = 1; ti->provision_supported = true; + ti->max_provision_granularity = true; mutex_unlock(&dm_thin_pool_table.mutex);