From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 826A6C6FA82 for ; Fri, 23 Sep 2022 14:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663943023; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Era/hVdmFb8jNsJ8qJ+W+F+uHK8F1Cp/U0gHgHCta9I=; b=bZo6YGO23jSfEVobmYlQDO3V8bY6VvL7y1jPxHHumNQ9lt6LHjRtB6y2i/eKWsNloQaUaf ATj/SDw/AP0Oq69xwF6j3k3T2svSZxqODP8xCrR9j2cdOoRolVjWfigZBQMUO3fSY9cQ0z v+K55xzXkn7t7SDEXME9vxAVMA1SvIQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-275-ZI4Zk4QjNLe853IvDjquzA-1; Fri, 23 Sep 2022 10:23:40 -0400 X-MC-Unique: ZI4Zk4QjNLe853IvDjquzA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D202185A7AA; Fri, 23 Sep 2022 14:23:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7F9249BB60; Fri, 23 Sep 2022 14:23:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9317C19465B6; Fri, 23 Sep 2022 14:23:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5318319465A4 for ; Fri, 23 Sep 2022 14:23:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3C1A1492B0A; Fri, 23 Sep 2022 14:23:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 346E4492B09 for ; Fri, 23 Sep 2022 14:23:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A768B877CA4 for ; Fri, 23 Sep 2022 14:23:28 +0000 (UTC) Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-569-5Oq0tR3tPXOHXyLGt-i-1g-1; Fri, 23 Sep 2022 10:23:27 -0400 X-MC-Unique: 5Oq0tR3tPXOHXyLGt-i-1g-1 Received: by mail-qk1-f200.google.com with SMTP id az15-20020a05620a170f00b006cece4cd0beso94864qkb.22 for ; Fri, 23 Sep 2022 07:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=MtMta5sZ7F8zj2gNZ2FUjMLqWdc2TCa8gGZwFvL5igI=; b=3/vII51kO6CloE/81bfdnR63HPcUBCrnYHuBiEkBdbzqtZU0JMhpbRfKjmhrfZA++8 dPUppOhzkJia+kM2I+TVZCkTGqdGfFoequRoeJ/KwnHNwb15mz1uVjne3v76wQ4+j+CL aE9eff+dgP4JSHecxeOOTL2QR95yJ61ApUKDq4Wn2a5OPs+Zwx8JantEUi81nKpaiMVr hAh8w8V8VfVeI74b+QfRwUua4OR3/jwbQ7CcdPYyQ3h2Inkix3dPUcXsf3H/TjzcOlzk aDHCO/snGxA9nLhEaklVMHm07glghgV3zJbgNzd88YU2q9n6wV9szPbHjmq61Wo81Oi4 uqZw== X-Gm-Message-State: ACrzQf0O7UvyZfmQRAH1ZyRdAzWBbbFleysKG9neUZBpwPMNi2f+mZJK uiUAReDMnH6YwdJ2ayE/SsiBzwUOo9ahg+3r8Fh6oo59U7tl995GsyZxDL8K/w5Nb+2pj0Whwia 2wG5fs1kpE+ssBg== X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781671qkk.572.1663943006692; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XaeBSmIgCS5xVoX7O37KV2Q4BatIbL+4W7934TQWhD9AMaj+EBoxQ49sZN/jgeEabR6YtNA== X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781650qkk.572.1663943006470; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Received: from localhost (pool-68-160-173-162.bstnma.fios.verizon.net. [68.160.173.162]) by smtp.gmail.com with ESMTPSA id y26-20020a37f61a000000b006ceb933a9fesm5847674qkj.81.2022.09.23.07.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Date: Fri, 23 Sep 2022 10:23:25 -0400 From: Mike Snitzer To: Sarthak Kukreti Message-ID: References: <20220915164826.1396245-1-sarthakkukreti@google.com> <20220915164826.1396245-3-sarthakkukreti@google.com> MIME-Version: 1.0 In-Reply-To: <20220915164826.1396245-3-sarthakkukreti@google.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Subject: Re: [dm-devel] [PATCH RFC 2/8] dm: Add support for block provisioning X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Axboe , Gwendal Grignou , Theodore Ts'o , "Michael S . Tsirkin" , Jason Wang , Bart Van Assche , Mike Snitzer , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, dm-devel@redhat.com, Andreas Dilger , Daniil Lunev , Stefan Hajnoczi , Paolo Bonzini , linux-ext4@vger.kernel.org, Evan Green , Alasdair Kergon Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Sep 15 2022 at 12:48P -0400, Sarthak Kukreti wrote: > From: Sarthak Kukreti > > Add support to dm devices for REQ_OP_PROVISION. The default mode > is to pass through the request and dm-thin will utilize it to provision > blocks. > > Signed-off-by: Sarthak Kukreti > --- > drivers/md/dm-crypt.c | 4 +- > drivers/md/dm-linear.c | 1 + > drivers/md/dm-table.c | 17 +++++++ > drivers/md/dm-thin.c | 86 +++++++++++++++++++++++++++++++++-- > drivers/md/dm.c | 4 ++ > include/linux/device-mapper.h | 6 +++ > 6 files changed, 113 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c > index 159c6806c19b..357f0899cfb6 100644 > --- a/drivers/md/dm-crypt.c > +++ b/drivers/md/dm-crypt.c > @@ -3081,6 +3081,8 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar > if (ret) > return ret; > > + ti->num_provision_bios = 1; > + > while (opt_params--) { > opt_string = dm_shift_arg(&as); > if (!opt_string) { > @@ -3384,7 +3386,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) > * - for REQ_OP_DISCARD caller must use flush if IO ordering matters > */ > if (unlikely(bio->bi_opf & REQ_PREFLUSH || > - bio_op(bio) == REQ_OP_DISCARD)) { > + bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_PROVISION)) { > bio_set_dev(bio, cc->dev->bdev); > if (bio_sectors(bio)) > bio->bi_iter.bi_sector = cc->start + > diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c > index 3212ef6aa81b..1aa782149428 100644 > --- a/drivers/md/dm-linear.c > +++ b/drivers/md/dm-linear.c > @@ -61,6 +61,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) > ti->num_discard_bios = 1; > ti->num_secure_erase_bios = 1; > ti->num_write_zeroes_bios = 1; > + ti->num_provision_bios = 1; > ti->private = lc; > return 0; > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 332f96b58252..b7f9cb66b7ba 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1853,6 +1853,18 @@ static bool dm_table_supports_write_zeroes(struct dm_table *t) > return true; > } > > +static bool dm_table_supports_provision(struct dm_table *t) > +{ > + for (unsigned int i = 0; i < t->num_targets; i++) { > + struct dm_target *ti = dm_table_get_target(t, i); > + > + if (ti->num_provision_bios) > + return true; > + } > + > + return false; > +} > + This needs to go a step further and verify a device in the stack actually services REQ_OP_PROVISION. Please see dm_table_supports_discards(): it iterates all devices in the table and checks that support is advertised. For discard, DM requires that _all_ devices in a table advertise support (that is pretty strict and likely could be relaxed to _any_). You'll need ti->provision_supported (like ->discards_supported) to advertise actual support is provided by dm-thinp (even if underlying devices don't support it). And yeah, dm-thinp passdown support for REQ_OP_PROVISION can follow later as needed (if there actual HW that would benefit from REQ_OP_PROVISION). Mike -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D267DC6FA90 for ; Fri, 23 Sep 2022 14:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232589AbiIWOXf (ORCPT ); Fri, 23 Sep 2022 10:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232552AbiIWOXb (ORCPT ); Fri, 23 Sep 2022 10:23:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9BA13B023 for ; Fri, 23 Sep 2022 07:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663943009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MtMta5sZ7F8zj2gNZ2FUjMLqWdc2TCa8gGZwFvL5igI=; b=aYX7wOfswgVM4YQfQbOoM2q04BjNYwzKtoQjas3BcJq4veSejrV1YIhwfuIEcPyc6hQjhc GOeyOSu9cspMY8TlVUtAYZ+qqbTFgNh8atYwclRCifbf11glVV9kU+HRnvt5C80S/uMdlQ Mx6KkuLFXh+Kg0W5RkHesQaeEnRugug= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-480-MO9u59p1NzKyAGeH8iw14w-1; Fri, 23 Sep 2022 10:23:28 -0400 X-MC-Unique: MO9u59p1NzKyAGeH8iw14w-1 Received: by mail-qv1-f71.google.com with SMTP id i10-20020ad45c6a000000b004a25d0fea96so8602380qvh.3 for ; Fri, 23 Sep 2022 07:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=MtMta5sZ7F8zj2gNZ2FUjMLqWdc2TCa8gGZwFvL5igI=; b=62Ut6tBtXshpi+HzYtXBvjWa1828CrNnP7xt+Y7LfAJwK/Jx2IR7JHyP/Z+yhFf/Ak eq8smUmJmM3vHCmjsF5usCeE4YJNmkwRtuh96EfL57bNIYBSE3PRx4hJIipCVLjvEpkI kDGGAv4iuimPZpJvz+85TIpamOqK7DL7/vDFYc9i270xuEsxxWEPiQYmg/M+Pk7etwLI PilKf/z4h7Zvys2oVTCnHtEpBx0ir/9/tmOK20WfWSG6D8eoomev44Yk6IwSzDKqYQRR KnWC33JT8OlqIwOYq235at/iROnNhTohvuzPL+xoxyOJqHqAj9s74ii9sYYszpiJE1Ak DZIQ== X-Gm-Message-State: ACrzQf21d7rJzZdLci6oRDyrFfthnkavBBHqr30ubyjvHkxykoezJOLZ PcPeL638CyQ8IBimOEb6nnpUyOFO5MjsGApwMAPlkeBOqaww1akh289Of8HCDV+j6lbHi+VMRer Y3evaN5lTVzWOg7v5OYyCSA== X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781674qkk.572.1663943006692; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XaeBSmIgCS5xVoX7O37KV2Q4BatIbL+4W7934TQWhD9AMaj+EBoxQ49sZN/jgeEabR6YtNA== X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781650qkk.572.1663943006470; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Received: from localhost (pool-68-160-173-162.bstnma.fios.verizon.net. [68.160.173.162]) by smtp.gmail.com with ESMTPSA id y26-20020a37f61a000000b006ceb933a9fesm5847674qkj.81.2022.09.23.07.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Date: Fri, 23 Sep 2022 10:23:25 -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, virtualization@lists.linux-foundation.org, Jens Axboe , "Michael S . Tsirkin" , Jason Wang , Paolo Bonzini , Stefan Hajnoczi , Alasdair Kergon , Mike Snitzer , Theodore Ts'o , Andreas Dilger , Bart Van Assche , Daniil Lunev , Evan Green , Gwendal Grignou Subject: Re: [PATCH RFC 2/8] dm: Add support for block provisioning Message-ID: References: <20220915164826.1396245-1-sarthakkukreti@google.com> <20220915164826.1396245-3-sarthakkukreti@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220915164826.1396245-3-sarthakkukreti@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Thu, Sep 15 2022 at 12:48P -0400, Sarthak Kukreti wrote: > From: Sarthak Kukreti > > Add support to dm devices for REQ_OP_PROVISION. The default mode > is to pass through the request and dm-thin will utilize it to provision > blocks. > > Signed-off-by: Sarthak Kukreti > --- > drivers/md/dm-crypt.c | 4 +- > drivers/md/dm-linear.c | 1 + > drivers/md/dm-table.c | 17 +++++++ > drivers/md/dm-thin.c | 86 +++++++++++++++++++++++++++++++++-- > drivers/md/dm.c | 4 ++ > include/linux/device-mapper.h | 6 +++ > 6 files changed, 113 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c > index 159c6806c19b..357f0899cfb6 100644 > --- a/drivers/md/dm-crypt.c > +++ b/drivers/md/dm-crypt.c > @@ -3081,6 +3081,8 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar > if (ret) > return ret; > > + ti->num_provision_bios = 1; > + > while (opt_params--) { > opt_string = dm_shift_arg(&as); > if (!opt_string) { > @@ -3384,7 +3386,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) > * - for REQ_OP_DISCARD caller must use flush if IO ordering matters > */ > if (unlikely(bio->bi_opf & REQ_PREFLUSH || > - bio_op(bio) == REQ_OP_DISCARD)) { > + bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_PROVISION)) { > bio_set_dev(bio, cc->dev->bdev); > if (bio_sectors(bio)) > bio->bi_iter.bi_sector = cc->start + > diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c > index 3212ef6aa81b..1aa782149428 100644 > --- a/drivers/md/dm-linear.c > +++ b/drivers/md/dm-linear.c > @@ -61,6 +61,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) > ti->num_discard_bios = 1; > ti->num_secure_erase_bios = 1; > ti->num_write_zeroes_bios = 1; > + ti->num_provision_bios = 1; > ti->private = lc; > return 0; > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 332f96b58252..b7f9cb66b7ba 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1853,6 +1853,18 @@ static bool dm_table_supports_write_zeroes(struct dm_table *t) > return true; > } > > +static bool dm_table_supports_provision(struct dm_table *t) > +{ > + for (unsigned int i = 0; i < t->num_targets; i++) { > + struct dm_target *ti = dm_table_get_target(t, i); > + > + if (ti->num_provision_bios) > + return true; > + } > + > + return false; > +} > + This needs to go a step further and verify a device in the stack actually services REQ_OP_PROVISION. Please see dm_table_supports_discards(): it iterates all devices in the table and checks that support is advertised. For discard, DM requires that _all_ devices in a table advertise support (that is pretty strict and likely could be relaxed to _any_). You'll need ti->provision_supported (like ->discards_supported) to advertise actual support is provided by dm-thinp (even if underlying devices don't support it). And yeah, dm-thinp passdown support for REQ_OP_PROVISION can follow later as needed (if there actual HW that would benefit from REQ_OP_PROVISION). Mike From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0321C6FA82 for ; Fri, 23 Sep 2022 14:23:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 28494813C0; Fri, 23 Sep 2022 14:23:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 28494813C0 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N2eQy8M9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IdkUeggrIOWl; Fri, 23 Sep 2022 14:23:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 684A6812DE; Fri, 23 Sep 2022 14:23:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 684A6812DE Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4F439C0033; Fri, 23 Sep 2022 14:23:32 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 22682C002D for ; Fri, 23 Sep 2022 14:23:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E24D040082 for ; Fri, 23 Sep 2022 14:23:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E24D040082 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=N2eQy8M9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WLtg-PFg9-0Q for ; Fri, 23 Sep 2022 14:23:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C19D240114 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id C19D240114 for ; Fri, 23 Sep 2022 14:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663943008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MtMta5sZ7F8zj2gNZ2FUjMLqWdc2TCa8gGZwFvL5igI=; b=N2eQy8M9WK0KndyPz7YJIe9AhbZ/9B0/GpeRNPAOzOxMnt1IjGo9vnui+5SSwRrJ+j8BHr A88SwCWyibMLYuAcY+GTh0iKSkdlG0zACcUeQHZVmmSo8xQOfFgnO724AcCR92ZhrKpDKp prnGSPEx/6D2XS8/fwvndYbR7Xw+3qk= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-482-q9TNeSgnOh60W__ISIDRng-1; Fri, 23 Sep 2022 10:23:27 -0400 X-MC-Unique: q9TNeSgnOh60W__ISIDRng-1 Received: by mail-qv1-f69.google.com with SMTP id q5-20020a056214194500b004a03466c568so8653943qvk.19 for ; Fri, 23 Sep 2022 07:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=MtMta5sZ7F8zj2gNZ2FUjMLqWdc2TCa8gGZwFvL5igI=; b=639IVw8wivsGrp5o/JcZwBAQOl3A2U9Jh5Gx4UgBLg3RNyqnlluefeu0UDrPzjCWKw dAOuA934oY1blF5h6q/vINsgFZjG9XUjyNo4qpLNS/DA5Ke2kZJ+MCVtRQ1mcGNYtHkb dXd9/9U8T9JewOT5363Om4HkmF+HTt+0wKywA2paBfaHpk2Vr4QnGk+w1sBtHuVxOvng I+HNhMrzSCfbWlTosIZMEpjMs1g9kmfbMKZuSaC9lHBVOtJOWU86cgIXDQzTZWK3yDMJ qu+Mzxs43UMY87ySzxQv9sZxq5yoLcgfKvc7J8fuf6psC2bl2FI8uPRwxP+RJDyeOL5o mLRw== X-Gm-Message-State: ACrzQf3ZiE8ZzU6uAOl9cy0LlbpvRA4nKez4M48tyFcbOKRYCxZADEij /g/BfddeTuXJCpTi0Ld6e8sG/RmTvjjbLX8YbojonJEoGtNC/auALyIvdWjrPiKKH9LNZ56uPFR WjpQdUfBszsDy1DvUBNAUoW5LDtwTHTiOC9UoEm4r X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781663qkk.572.1663943006691; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XaeBSmIgCS5xVoX7O37KV2Q4BatIbL+4W7934TQWhD9AMaj+EBoxQ49sZN/jgeEabR6YtNA== X-Received: by 2002:a37:ef18:0:b0:6ce:175f:409a with SMTP id j24-20020a37ef18000000b006ce175f409amr5781650qkk.572.1663943006470; Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Received: from localhost (pool-68-160-173-162.bstnma.fios.verizon.net. [68.160.173.162]) by smtp.gmail.com with ESMTPSA id y26-20020a37f61a000000b006ceb933a9fesm5847674qkj.81.2022.09.23.07.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 07:23:26 -0700 (PDT) Date: Fri, 23 Sep 2022 10:23:25 -0400 From: Mike Snitzer To: Sarthak Kukreti Subject: Re: [PATCH RFC 2/8] dm: Add support for block provisioning Message-ID: References: <20220915164826.1396245-1-sarthakkukreti@google.com> <20220915164826.1396245-3-sarthakkukreti@google.com> MIME-Version: 1.0 In-Reply-To: <20220915164826.1396245-3-sarthakkukreti@google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: Jens Axboe , Gwendal Grignou , Theodore Ts'o , "Michael S . Tsirkin" , Bart Van Assche , Mike Snitzer , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, dm-devel@redhat.com, Andreas Dilger , Daniil Lunev , Stefan Hajnoczi , Paolo Bonzini , linux-ext4@vger.kernel.org, Evan Green , Alasdair Kergon X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Thu, Sep 15 2022 at 12:48P -0400, Sarthak Kukreti wrote: > From: Sarthak Kukreti > > Add support to dm devices for REQ_OP_PROVISION. The default mode > is to pass through the request and dm-thin will utilize it to provision > blocks. > > Signed-off-by: Sarthak Kukreti > --- > drivers/md/dm-crypt.c | 4 +- > drivers/md/dm-linear.c | 1 + > drivers/md/dm-table.c | 17 +++++++ > drivers/md/dm-thin.c | 86 +++++++++++++++++++++++++++++++++-- > drivers/md/dm.c | 4 ++ > include/linux/device-mapper.h | 6 +++ > 6 files changed, 113 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c > index 159c6806c19b..357f0899cfb6 100644 > --- a/drivers/md/dm-crypt.c > +++ b/drivers/md/dm-crypt.c > @@ -3081,6 +3081,8 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar > if (ret) > return ret; > > + ti->num_provision_bios = 1; > + > while (opt_params--) { > opt_string = dm_shift_arg(&as); > if (!opt_string) { > @@ -3384,7 +3386,7 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) > * - for REQ_OP_DISCARD caller must use flush if IO ordering matters > */ > if (unlikely(bio->bi_opf & REQ_PREFLUSH || > - bio_op(bio) == REQ_OP_DISCARD)) { > + bio_op(bio) == REQ_OP_DISCARD || bio_op(bio) == REQ_OP_PROVISION)) { > bio_set_dev(bio, cc->dev->bdev); > if (bio_sectors(bio)) > bio->bi_iter.bi_sector = cc->start + > diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c > index 3212ef6aa81b..1aa782149428 100644 > --- a/drivers/md/dm-linear.c > +++ b/drivers/md/dm-linear.c > @@ -61,6 +61,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) > ti->num_discard_bios = 1; > ti->num_secure_erase_bios = 1; > ti->num_write_zeroes_bios = 1; > + ti->num_provision_bios = 1; > ti->private = lc; > return 0; > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 332f96b58252..b7f9cb66b7ba 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1853,6 +1853,18 @@ static bool dm_table_supports_write_zeroes(struct dm_table *t) > return true; > } > > +static bool dm_table_supports_provision(struct dm_table *t) > +{ > + for (unsigned int i = 0; i < t->num_targets; i++) { > + struct dm_target *ti = dm_table_get_target(t, i); > + > + if (ti->num_provision_bios) > + return true; > + } > + > + return false; > +} > + This needs to go a step further and verify a device in the stack actually services REQ_OP_PROVISION. Please see dm_table_supports_discards(): it iterates all devices in the table and checks that support is advertised. For discard, DM requires that _all_ devices in a table advertise support (that is pretty strict and likely could be relaxed to _any_). You'll need ti->provision_supported (like ->discards_supported) to advertise actual support is provided by dm-thinp (even if underlying devices don't support it). And yeah, dm-thinp passdown support for REQ_OP_PROVISION can follow later as needed (if there actual HW that would benefit from REQ_OP_PROVISION). Mike _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization