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 9337FC77B7A for ; Mon, 29 May 2023 17:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229461AbjE2Rk6 (ORCPT ); Mon, 29 May 2023 13:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjE2Rk5 (ORCPT ); Mon, 29 May 2023 13:40:57 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CCAAB for ; Mon, 29 May 2023 10:40:56 -0700 (PDT) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D97D121A60; Mon, 29 May 2023 17:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1685382054; h=from:from:reply-to:reply-to: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=yTTA+mIC9OU+CKW4ni+XcPtmJ6PEP8RBZuTxVHNJVUc=; b=EIoljln5lfRzo3Uypzzs9c5kqpEGb1kcPMZ7VZgujBjXIC2ig4raA4oDo/jlOCjHaCdcSn Lt/+9m+KmCGW0OredcgMb7+xOCdvsLO4Qblrpi0rWpE1lZK1FrSjcpQ+3wCgT+IrIyV++E EkqbexX5kPkEC9vQp+/KSebfrDbAe4Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1685382054; h=from:from:reply-to:reply-to: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=yTTA+mIC9OU+CKW4ni+XcPtmJ6PEP8RBZuTxVHNJVUc=; b=enSTxxA45GJPqkMyLwbZxiD7fWQRLZ6E/c8wnx+BNKlaEMVJxDXBFtEyNcmyoGEkKaRWcb Aq1Z88KO7ZOPbeDw== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id AA0B5134BC; Mon, 29 May 2023 17:40:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id ov9rKKbjdGQBIwAAGKfGzw (envelope-from ); Mon, 29 May 2023 17:40:54 +0000 Date: Mon, 29 May 2023 19:34:44 +0200 From: David Sterba To: Christoph Hellwig Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: Re: [PATCH 02/16] btrfs: factor out a btrfs_verify_page helper Message-ID: <20230529173444.GJ575@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20230523081322.331337-1-hch@lst.de> <20230523081322.331337-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230523081322.331337-3-hch@lst.de> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Tue, May 23, 2023 at 10:13:08AM +0200, Christoph Hellwig wrote: > Split all the conditionals for the fsverity calls in end_page_read into > a btrfs_verify_page helper to keep the code readable and make additional > refacoring easier. > > Signed-off-by: Christoph Hellwig > --- > fs/btrfs/extent_io.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index c1b0ca94be34e1..fc48888742debd 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -481,6 +481,15 @@ void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end, > start, end, page_ops, NULL); > } > > +static int btrfs_verify_page(struct page *page, u64 start) This should match return value of fsverity_verify_page() which is bool. > +{ > + if (!fsverity_active(page->mapping->host) || > + PageError(page) || PageUptodate(page) || > + start >= i_size_read(page->mapping->host)) > + return true; This is right, so the 'int' was probably a typo. > + return fsverity_verify_page(page); > +}