Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2618506rwd; Mon, 15 May 2023 14:26:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40gW2s39NN5Z7/oSmMN/Fmi+a7cAnSjX3OTHmxBkjNUmSSw2wN2ZLho/bZl8KVaiT5hbVI X-Received: by 2002:a05:6a20:8416:b0:ec:d7cf:bcf7 with SMTP id c22-20020a056a20841600b000ecd7cfbcf7mr43708932pzd.17.1684185983557; Mon, 15 May 2023 14:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684185983; cv=none; d=google.com; s=arc-20160816; b=JsrR4j7HCN6A8h2o0v0WqRBF9X59sQslH1N2DS2iHYlCwANuH0c7DyzRYNY2lyv2+F sFAWRXYaCbViyE30JqqGgrJLU7Kh6v4EZB2FhkWJYV5j8M0+6WkaXjFsyDXP1C6DaP0U Wh+P5piuY3dlK52Fejq0gaqLrwdcOLWexEdz+vcFVkaFf1f+Ghv+ycYsbCfZUlz9jnFe cJZgZc3ch4Y/qR5bJ98Hwwcz7k++XwY0q7uGhgUhCf0zuUSVB6slGA7DYMnjnKGgcKkD Xfejq9CbLw0QPrU3SibPu4eNkcqz0cWrBAePGI+Nt9y8tDuGT2j7xEw6F0GKy2d8Ep4k SEWQ== 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=iCAGJRSZlOdbZk8TJO2+IV5B/w81wFfW9jtMkWpTH+M=; b=DWsur7AuVV4BL2IRHpKyUcgeKtX7+Tm4wS00m7YyT79AWY/6rIeB9T/apK2QNgEsIx 0QJPrltpc1O5CF17iIYnnS9qDQ5fjLdFFNa7TzrpUvPIWKI3FbL6stu+3Jpx8qpuovwW TEy75NyeTro0wTWfWON5pLEpJmdOGg1cPcu9dSZp3RyluenoVKMy2htDUVo/+GiaXKWG JMPYBmXgzxJqrP4vmuYCFpY1yXjLqzANLJvGuGu8T8EAAIXLTYmjsLlwJLh665JHxy+r g25MuNsNmcSfD8XXyEzI1xyKcKL7ufkjqp0av2UAE3cNT/vS3FcODDBfr9IwuEo+sXc5 eYiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Fvz8x0dN; 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 e20-20020a633714000000b0052c2b1efee2si7432498pga.339.2023.05.15.14.25.59; Mon, 15 May 2023 14:26:23 -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=Fvz8x0dN; 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 S243061AbjEOVTf (ORCPT + 99 others); Mon, 15 May 2023 17:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjEOVTe (ORCPT ); Mon, 15 May 2023 17:19:34 -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 00CB0D05A for ; Mon, 15 May 2023 14:19:32 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-96aae59bbd6so792349166b.3 for ; Mon, 15 May 2023 14:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684185571; x=1686777571; 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=iCAGJRSZlOdbZk8TJO2+IV5B/w81wFfW9jtMkWpTH+M=; b=Fvz8x0dNvAfi6vn1MsWVsrIVhI0JC8Py8rU64fVV7c1WYzdrPJSFY/nJ5/ha/SBSdW O9Qrv+J04LkWY26V+6ISj9fbwtnonPqRY48vi74RSHlcYaXNOdDEzZhPQlpxhzKkIUJ0 9wiJslfn6dHpTu8YNli6Te99vlovWTdFmnEfc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684185571; x=1686777571; 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=iCAGJRSZlOdbZk8TJO2+IV5B/w81wFfW9jtMkWpTH+M=; b=IQ9rF1bhrSBQ5DaTr+QJ6/clMlgVZBqUD38/P4/SjtN3YLVN6sSgbt1InKFK+o0dWM bl4C9waeOFdEAYynr8cmLU+fhZ9czXWoBd7XFCdkUhs/nGcmeMVufJZxrShJxjkadxTA ovzvWEXSKpC25XPIq258N7xYHCFSk+8RgnRyXRYNEpoUoIzrI2BV4fWznZLfjR7Vf3fk ZByNAeG84Yv0ii1dicbbCKGuZ13FRSXUGNrEPpiYYCWCCOSuywOsIBE6yNf4Tk3urFZ8 r+6dIKjTiQfpPPNLcJ5gajYa+PFeRVujj3KXrfBJYYHtjBRzp753T8CwcO7qUSkewcK5 JXtg== X-Gm-Message-State: AC+VfDw+ewP34ltm/zTGNUBcCVBliLPt+VK39mGpMGKjTRnynM+G/oUb 5xr8KmjfxjuhSki2Cm1DFJ6doPN6MIM6YC+HSbOMUA== X-Received: by 2002:a17:907:9485:b0:96a:b12d:2fdf with SMTP id dm5-20020a170907948500b0096ab12d2fdfmr10487913ejc.12.1684185571480; Mon, 15 May 2023 14:19:31 -0700 (PDT) MIME-Version: 1.0 References: <20230420004850.297045-1-sarthakkukreti@chromium.org> <20230506062909.74601-1-sarthakkukreti@chromium.org> <20230506062909.74601-5-sarthakkukreti@chromium.org> In-Reply-To: From: Sarthak Kukreti Date: Mon, 15 May 2023 14:19:20 -0700 Message-ID: Subject: Re: [PATCH v6 4/5] dm-thin: Add REQ_OP_PROVISION support To: Mike Snitzer 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 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=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-ext4@vger.kernel.org On Fri, May 12, 2023 at 10:32=E2=80=AFAM Mike Snitzer = wrote: > > 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, s= truct 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 =3D 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: > Ah right, thanks for pointing that out! I'll fold this into v7. Best Sarthak > 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, str= uct queue_limits *limits) > blk_limits_io_opt(limits, pool->sectors_per_block << SECT= OR_SHIFT); > } > > + limits->max_provision_sectors =3D pool->sectors_per_block; > + > /* > * pt->adjusted_pf is a staging area for the actual features to u= se. > * They get transferred to the live pool in bind_control_target() > @@ -4171,8 +4173,6 @@ static void pool_io_hints(struct dm_target *ti, str= uct 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 =3D pool->sectors_per_block; > } > > static struct target_type pool_target =3D { > @@ -4349,6 +4349,7 @@ static int thin_ctr(struct dm_target *ti, unsigned = int argc, char **argv) > > ti->num_provision_bios =3D 1; > ti->provision_supported =3D true; > + ti->max_provision_granularity =3D true; > > mutex_unlock(&dm_thin_pool_table.mutex); >