Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2660092rwd; Fri, 19 May 2023 08:31:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41OS7LCiwdYd1zF6PP6pgRE7S9VL/apAHkP99fH6bKBjq1fGx4/KylZCHFw8A/DgKOqWe2 X-Received: by 2002:a05:6a00:a1a:b0:63d:47c8:856e with SMTP id p26-20020a056a000a1a00b0063d47c8856emr4559356pfh.2.1684510312918; Fri, 19 May 2023 08:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684510312; cv=none; d=google.com; s=arc-20160816; b=vI9UAbo9wHOLTqv4OfsMUrZxy5rB7sGGKCDFGuKoG6mk3K2ufhGm2UAju7NTWg7iH6 pz0+OLumbOh8HtjpKKXbzHQCHcbEMZLr+hEVqzSPmoicL9tn2K1H1LSP+QIxtKOYmmva gnGQjRV//tl9Gpuk/anrRT82IE4H6ndGl3Nb7Cax9GI43Nq/mvG2UTyiIZ6ktsdygZQa vJCl441IHuZWOKconrK6siMQ5dY1gt9i0MZKylrwTxgbqSQnThmO9NJzfMJU6/pTGFep Jr4g66a206eZVoy9/V1bTRghVKXXfPFRDd6ywoJy1yODNjl+A07sSXpDOOUzLoFqoRu5 zP1Q== 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=KQivtLqNJRG8EpR/lUW7uy3izlo40t0jANCAkNQxEPE=; b=tI7XaM4kLa+rfU0DWD59HYmJZnu6hTBcZh0jhnmoiAq3M0AQcA40PKk7aqnuI6lr7V jPyRLeXQhqQhBSIqthq8Hm5LK6Wn1pCe3gmK7G11hI2r6firRS+HUSg+c9CGvijYlDmg qAfxlJW6t+qnG4yy4GQEyWIB25R3kzwOuO76hzfI+gnqen8SsqS2pyCs8No4JxB+5Md0 8BMdle+hTYqsC8Novos5GqDqcVUhqbTRsDpFfBy7ZSt1bFY7Y8sN2Toa34TDu0tflYu6 hlUARZmGiSkVj37z/+g0KE8lmnA91DDpFUNSXu+qUebRjdptvmO6GdVBrBumuq5ZMhP6 fI7g== 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 f5-20020aa79d85000000b0063b64166faesi4028708pfq.157.2023.05.19.08.31.39; Fri, 19 May 2023 08:31:52 -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 S232321AbjESPYA (ORCPT + 99 others); Fri, 19 May 2023 11:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232326AbjESPX5 (ORCPT ); Fri, 19 May 2023 11:23:57 -0400 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C789313E for ; Fri, 19 May 2023 08:23:14 -0700 (PDT) Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-3f38711680dso16970641cf.1 for ; Fri, 19 May 2023 08:23:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684509794; x=1687101794; 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=KQivtLqNJRG8EpR/lUW7uy3izlo40t0jANCAkNQxEPE=; b=ZzfPSfcw/gsxvthY0Treoth/Uwz7DxHjHI3oPcNVGUiz4ULsHr02p0WYPgE07V6IL+ esX4gPetJ4AxOe6txqjcwiF9gL1C8RAbnqKkeOEuQuSjVSKE8c6v28vlt0D44CFC1U4Z n0omc7EYS4IquI75rLsTZh1t+E/9/ErZVGPrnRo7pGVq+tQBZWeWMK3JyQxf6jfVcf71 DRPcEFquiPo2wMHkiZl21UR+IU/uug+rDfUhAVr7+P4deQXWO2cgTZCkehnIxZc7Ki+5 6OCTnn7i4dvE9pVPI8aBxuUEbAqb4RMYYPD0SX1/N92HjZq6x2i240nleUwqBdfpOpwI 2xFg== X-Gm-Message-State: AC+VfDz2N/qii9j+C/pd8wAaLLO5WnUCGX2h34oPQZSTYfd60BlhPxU7 A4YhtCip3KxZJA4SeOxIiZpC X-Received: by 2002:a05:622a:192:b0:3f5:92b:eff9 with SMTP id s18-20020a05622a019200b003f5092beff9mr3992630qtw.46.1684509793876; Fri, 19 May 2023 08:23:13 -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 b28-20020a05620a127c00b0075941df3365sm1164925qkl.52.2023.05.19.08.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 08:23:13 -0700 (PDT) Date: Fri, 19 May 2023 11:23:12 -0400 From: Mike Snitzer To: Sarthak Kukreti , Joe Thornber 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 v7 4/5] dm-thin: Add REQ_OP_PROVISION support Message-ID: References: <20230518223326.18744-1-sarthakkukreti@chromium.org> <20230518223326.18744-5-sarthakkukreti@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230518223326.18744-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_H3, RCVD_IN_MSPIKE_WL,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 Thu, May 18 2023 at 6:33P -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 | 74 +++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 70 insertions(+), 4 deletions(-) > > diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c > index 2b13c949bd72..f1b68b558cf0 100644 > --- a/drivers/md/dm-thin.c > +++ b/drivers/md/dm-thin.c > @@ -1245,8 +1247,8 @@ static int io_overlaps_block(struct pool *pool, struct bio *bio) > > static int io_overwrites_block(struct pool *pool, struct bio *bio) > { > - return (bio_data_dir(bio) == WRITE) && > - io_overlaps_block(pool, bio); > + return (bio_data_dir(bio) == WRITE) && io_overlaps_block(pool, bio) && > + bio_op(bio) != REQ_OP_PROVISION; > } > > static void save_and_set_endio(struct bio *bio, bio_end_io_t **save, > @@ -1394,6 +1396,9 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block, > m->data_block = data_block; > m->cell = cell; > > + if (bio && bio_op(bio) == REQ_OP_PROVISION) > + m->bio = bio; > + > /* > * If the whole block of data is being overwritten or we are not > * zeroing pre-existing data, we can issue the bio immediately. This doesn't seem like the best way to address avoiding passdown of provision bios (relying on process_prepared_mapping's implementation that happens to do the right thing if m->bio set). Doing so cascades into relying on complete_overwrite_bio() happening to _not_ actually being specific to "overwrite" bios. I don't have a better suggestion yet but will look closer. Just think this needs to be formalized a bit more rather than it happening to "just work". Cc'ing Joe to see what he thinks too. This is something we can clean up with a follow-on patch though, so not a show-stopper for this series. Mike