Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp512667rwl; Wed, 5 Apr 2023 04:11:11 -0700 (PDT) X-Google-Smtp-Source: AKy350aMTkkXvUy5AkGS2UCzQUAuxUArS4VFtdz+xt7eDPglLE2XNQWKmLw/nhQUD+LIdwpmNo6i X-Received: by 2002:a05:6a20:b71e:b0:da:38d2:c27a with SMTP id fg30-20020a056a20b71e00b000da38d2c27amr4603041pzb.1.1680693071202; Wed, 05 Apr 2023 04:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680693071; cv=none; d=google.com; s=arc-20160816; b=Fta/V4q9+5k7hFYGgwNB1cVUsA85QZ5DJrwJpL2bO6u6FTMDAgXvhFRfF3hKMZ6Xx3 qh78vTZppxTLR/flM8hQQQ8LTzdztUGf1/lGYd/fmq9WloIS/rNtgyBw3wO6IoxqMm8e e+4/+DXDe0Tc3dcAxFK4rDlpAaObGzGhn1VYh1M5olynpwRt5/DgKIqWRso0120+Wll/ 6TOwiYckZkL71oGbs+DEvghgF58sgCK7YzqULWJ7qjpfdKt1W5T8mfM/1E8A9T/nRP1f sOaTsA3aSu/XJgk31zl0p5DoE12FQCYkI5NnItzSEbZ5AF1vmSvpOiDzKF86Lm5h3xUY 3FAg== 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:dkim-signature; bh=BoHgQZFE6GmfSeys+DR2W7oxw4hgWtoFTpySQ2VkKFk=; b=Tpf4mSyLhsQ4TbfxTIFgamU30meTT0HGRjeLGvai8IPoAXNIgPkEK8uHGy0UXmOKoi zr7QgmfV+dHXVpZL6cAlH5iRScGzENeUCkOXN4PI7TCaBSvGAWGPC6NSeCFsOe1MSLLu +yPjSPJPtA5HV5l1KQ31j9hZO1SMB0o78oZtsgoqVfAQWjcyDCi7/7GIQbUCkKB1HLsx YzaWg54Rib5m/sx3CMUhUzB42bO5AhsGWWbjpqS8pXBVNBuiXs5H9PmZYhM82BNaEROn DKxbGvro2hV3fZ+bdPXXoHnnZijs3YmmAAGJpTZrecI7WLgJOQUCSiSnC5VMUy1ofrSm 7IHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V0YFHs3q; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u27-20020a63235b000000b005031abe8d8bsi4155897pgm.745.2023.04.05.04.10.55; Wed, 05 Apr 2023 04:11:11 -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=@redhat.com header.s=mimecast20190719 header.b=V0YFHs3q; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236967AbjDELCO (ORCPT + 99 others); Wed, 5 Apr 2023 07:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237672AbjDELCN (ORCPT ); Wed, 5 Apr 2023 07:02:13 -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 AEC4E4C20 for ; Wed, 5 Apr 2023 04:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680692486; 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=BoHgQZFE6GmfSeys+DR2W7oxw4hgWtoFTpySQ2VkKFk=; b=V0YFHs3q1dLyZp4PMwJNCCZ33lAFL3XbzLK2np25QTW7So8YIDuXIa+RO/8Dnu2ClfuhnK ZPRWi7QRhYts68A5SRVeptxYKJ77Lv9cKPElSU901ixPibk7i2+Ak241hDyVxHeAUytT9c dncUlvYXYDjomzIs6g84eq76rx7baj8= 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_256_GCM_SHA384) id us-mta-220-TPejZr6HOS6G50D6FjGCrA-1; Wed, 05 Apr 2023 07:01:26 -0400 X-MC-Unique: TPejZr6HOS6G50D6FjGCrA-1 Received: by mail-qv1-f71.google.com with SMTP id y19-20020ad445b3000000b005a5123cb627so15999078qvu.20 for ; Wed, 05 Apr 2023 04:01:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680692485; 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=BoHgQZFE6GmfSeys+DR2W7oxw4hgWtoFTpySQ2VkKFk=; b=X//VTtvZzqbjLTdKVr1OMAo3Y8XYuKDS+9dGzCc4vCXmRNXHiCrcR4ESIJnk/GI9j7 RpwFXm0BO57G1Wach50j8/2TeeoMNJLrJ15fh2RHmUfRWWzrrf4Ns1EXrCYabLw4DThc gc7+krBxLkMxeNF3YfLODoMuVyYRZthZ79ikDXJeI3GPavJ4St4BKH0rQN+iW3NINedC wWYsyWHlujy22XabazqWlGRYYWW2oayI4f4ES3zW9A5UNUWWUtoT0pBvqnGowdB7vPc7 vFXFZ667eR7RpBP4GjIW5Uq4+R89H7mnY3oK5amOrPoW0biYtQ+wiSsL0IV5vwwzp8yN 2zjw== X-Gm-Message-State: AAQBX9f1KQrx3uxSCSianoN8XhDLumqtetjMzze7gRIecWN99fz7cThS 5uk3qVw1l3MfEI5By0J2PNfqvrA8UWq1uiH3VGwpEBiz6P9s82TB+wKJz2tZ/val7T7M9Jy3GR8 ogRgzW+00Ajcl6+YE1urc X-Received: by 2002:a05:6214:4001:b0:5ca:f6dd:f3b6 with SMTP id kd1-20020a056214400100b005caf6ddf3b6mr8311044qvb.16.1680692485357; Wed, 05 Apr 2023 04:01:25 -0700 (PDT) X-Received: by 2002:a05:6214:4001:b0:5ca:f6dd:f3b6 with SMTP id kd1-20020a056214400100b005caf6ddf3b6mr8310617qvb.16.1680692482068; Wed, 05 Apr 2023 04:01:22 -0700 (PDT) Received: from aalbersh.remote.csb ([109.183.6.197]) by smtp.gmail.com with ESMTPSA id om30-20020a0562143d9e00b005dd8b934576sm4136208qvb.14.2023.04.05.04.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 04:01:21 -0700 (PDT) Date: Wed, 5 Apr 2023 13:01:16 +0200 From: Andrey Albershteyn To: Christoph Hellwig Cc: djwong@kernel.org, dchinner@redhat.com, ebiggers@kernel.org, linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, rpeterso@redhat.com, agruenba@redhat.com, xiang@kernel.org, chao@kernel.org, damien.lemoal@opensource.wdc.com, jth@kernel.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com Subject: Re: [PATCH v2 09/23] iomap: allow filesystem to implement read path verification Message-ID: <20230405110116.ia5wv3qxbnpdciui@aalbersh.remote.csb> References: <20230404145319.2057051-1-aalbersh@redhat.com> <20230404145319.2057051-10-aalbersh@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Hi Christoph, On Tue, Apr 04, 2023 at 08:37:02AM -0700, Christoph Hellwig wrote: > > if (iomap_block_needs_zeroing(iter, pos)) { > > folio_zero_range(folio, poff, plen); > > + if (iomap->flags & IOMAP_F_READ_VERITY) { > > Wju do we need the new flag vs just testing that folio_ops and > folio_ops->verify_folio is non-NULL? Yes, it can be just test, haven't noticed that it's used only here, initially I used it in several places. > > > - ctx->bio = bio_alloc(iomap->bdev, bio_max_segs(nr_vecs), > > - REQ_OP_READ, gfp); > > + ctx->bio = bio_alloc_bioset(iomap->bdev, bio_max_segs(nr_vecs), > > + REQ_OP_READ, GFP_NOFS, &iomap_read_ioend_bioset); > > All other callers don't really need the larger bioset, so I'd avoid > the unconditional allocation here, but more on that later. Ok, make sense. > > > + ioend = container_of(ctx->bio, struct iomap_read_ioend, > > + read_inline_bio); > > + ioend->io_inode = iter->inode; > > + if (ctx->ops && ctx->ops->prepare_ioend) > > + ctx->ops->prepare_ioend(ioend); > > + > > So what we're doing in writeback and direct I/O, is to: > > a) have a submit_bio hook > b) allow the file system to then hook the bi_end_io caller > c) (only in direct O/O for now) allow the file system to provide > a bio_set to allocate from I see. > > I wonder if that also makes sense and keep all the deferral in the > file system. We'll need that for the btrfs iomap conversion anyway, > and it seems more flexible. The ioend processing would then move into > XFS. > Not sure what you mean here. > > @@ -156,6 +160,11 @@ struct iomap_folio_ops { > > * locked by the iomap code. > > */ > > bool (*iomap_valid)(struct inode *inode, const struct iomap *iomap); > > + > > + /* > > + * Verify folio when successfully read > > + */ > > + bool (*verify_folio)(struct folio *folio, loff_t pos, unsigned int len); > > Why isn't this in iomap_readpage_ops? > Yes, it can be. But it appears to me to be more relevant to _folio_ops, any particular reason to move it there? Don't mind moving it to iomap_readpage_ops. -- - Andrey