From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4E1D3EBF08; Wed, 25 Mar 2026 16:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774455964; cv=none; b=eg5YB5pnu0XPBcyu/rXfWRQDgwlzajq6/cJNQ9NuMyJswlaMO3P7FAdKbsAe3MUR7LBGtNT6JooM4lOGYLFe9sMJremjx02CwoQjqQQb/EsjpSSUpDNjFUce5BrBY0uNE7E5LpHs53K5pepidhXMrr7Um78IaRCfbpsXuaLkt/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774455964; c=relaxed/simple; bh=D1i5YPn3nepsXs93Y3yzjR5xi7srB1NJEGzhg5tNUh8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IwkXVKQOKQvb+zwDV1QOfBdRDbhmGg31C+MTWTAcNarVZy0/QQURgogOB9Ec/bIcAqpixkbNyIz7cMQr5V2hPU9DpwEoWIE5ffEVCdbRP4NmP7qgs2O89Sw4tPLyGlFY27DQuA5GNqTxIp986iWffcZ6L3GA5HXlWIWsaXZrykA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H451FRpv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H451FRpv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44ED5C4CEF7; Wed, 25 Mar 2026 16:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774455964; bh=D1i5YPn3nepsXs93Y3yzjR5xi7srB1NJEGzhg5tNUh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H451FRpvxj6W/wUJepeJeqwD2HaLpYiOjcnAFQFLYd1zrf0tNxBCMYib/8sbgTnDl E9XUS9V2npYvDxkZZS6wzjIebTHBCFot6rljh7KiordjLkgymLg4Su5kHgItNO7aDw Mq+00OcZ5O9/oSXtH8GJeoRn5w26Yi67/PA75L1n1aedt/eCRnhwN1P7eOTPTbzUHv AhFtsLlxuOyxOpQkogHPmr6WejMj9icfWk7dvcHA5nuwykYzarrJPhz8yrZWyFU6uA JFRvSYFRKLnZZh1kx0utkkrbkptYIooI1udWvhMIXFVpEr92XBC84YrjaLmUDESEKj njVh1bSJYvbXw== Date: Wed, 25 Mar 2026 09:26:03 -0700 From: "Darrick J. Wong" To: Andrey Albershteyn Cc: Christoph Hellwig , Andrey Albershteyn , linux-xfs@vger.kernel.org, fsverity@lists.linux.dev, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org Subject: Re: [PATCH v5 07/25] iomap: introduce IOMAP_F_FSVERITY and teach writeback to handle fsverity Message-ID: <20260325162603.GV6223@frogsfrogsfrogs> References: <20260319170231.1455553-1-aalbersh@kernel.org> <20260319170231.1455553-8-aalbersh@kernel.org> <20260325080021.GF952@lst.de> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 25, 2026 at 01:38:07PM +0100, Andrey Albershteyn wrote: > On 2026-03-25 09:00:21, Christoph Hellwig wrote: > > > @@ -353,9 +353,16 @@ static inline bool iomap_block_needs_zeroing(const struct iomap_iter *iter, > > > { > > > const struct iomap *srcmap = iomap_iter_srcmap(iter); > > > > > > - return srcmap->type != IOMAP_MAPPED || > > > - (srcmap->flags & IOMAP_F_NEW) || > > > - pos >= i_size_read(iter->inode); > > > + if (srcmap->type != IOMAP_MAPPED) > > > + return true; > > > + > > > + if (srcmap->flags & IOMAP_F_NEW) > > > + return true; > > > + > > > + if (srcmap->flags & IOMAP_F_FSVERITY) > > > + return false; > > > + > > > + return pos >= i_size_read(iter->inode); > > > > This might be a good time to document the various reasons for needing > > zeroing. > > something like this? > > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -344,9 +344,27 @@ static inline bool iomap_block_needs_zeroing(const struct iomap_iter *iter, > { > const struct iomap *srcmap = iomap_iter_srcmap(iter); > > - return srcmap->type != IOMAP_MAPPED || > - (srcmap->flags & IOMAP_F_NEW) || > - pos >= i_size_read(iter->inode); > + /* > + * If this block is not mapped, we don't have any backing blocks to read > + * yet /* If this block has not been written, there's nothing to read */ > + */ > + if (srcmap->type != IOMAP_MAPPED) > + return true; > + > + /* > + * This block just got allocated and does not contain any meaningful data > + */ /* Newly allocated blocks have not been written */ Otherwise looks good to me. --D > + if (srcmap->flags & IOMAP_F_NEW) > + return true; > + > + /* > + * fsverity metadata is stored past i_size, we need to read it instead of > + * zeroing > + */ > + if (srcmap->flags & IOMAP_F_FSVERITY) > + return false; > + > + return pos >= i_size_read(iter->inode); > } > > > > > > +/* > > > + * IO happens beyond inode EOF, fsverity metadata is stored there > > > + */ > > > +#define IOMAP_F_FSVERITY (1U << 10) > > > > This comment feels a bit too sparse. Here is my interpretation of what > > this flag does: > > > > /* > > * Indicates reads and writes of fsverity metadata. > > * > > * Fsverity metadata is stored after the regular file data and thus beyond > > * i_size. > > */ > > Thanks! I will update it > > -- > - Andrey > > 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (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 8A466109C036 for ; Wed, 25 Mar 2026 16:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aqmu2Yu+gw+T8SVqvQSM91CvNBBJ2qNoLcx2SFP1R2c=; b=Vjubdqa51r1JEalMEWC6KFHoH+ J0MiGtPIO57979VmRjVRPDr2EjE8mbAoVQuI8loGMmwkTAB81qkQjXHJaCzl8wTA8uysBdsG6dV8J 1L0unS5fG0hLX+1EVfZKhEsZWJpOFYeUYalwIyJbe0iwaRXuflqeumQ+2vvphT04hx0w=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1w5R3t-0004vh-JN; Wed, 25 Mar 2026 16:26:29 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1w5R3b-0004vE-9e for linux-f2fs-devel@lists.sourceforge.net; Wed, 25 Mar 2026 16:26:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rewysob7eA3CIB8fZ4Q2j5ub7wvmIkwsByKo0KjdZgM=; b=M16+bBT2A7blD0WC1LGWUG3wyh gIDbVUDYjSa8U97f/9+m1h45/dQOCRLHbVM4qNhaJzxfrjYtqm3Gb5EBgft5opgbEODYpGsJwvCfz 2cJcRnubYZ3i+wooN+8BHyqddwyc+odkqPhNMI4+rQsOeDMMoJ8zPFyuDWy85zfINInw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=rewysob7eA3CIB8fZ4Q2j5ub7wvmIkwsByKo0KjdZgM=; b=dK/hmDtAXH58HgEurlvmorxng5 YKwot/2O2qZFk7RwV1qKZIHpwjUcSRCm0y3bv5AoNCEIzDHYpig3prCR8n++pIL4vTxNpzRy4nuBJ fwKJMJPZGKfi+Qfuz/j1IjTZOyCDIZ9NDHHuTZyZDgMFS/F70IxMcjYbHmjOsQdtj0hU=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1w5R3a-0005sx-9h for linux-f2fs-devel@lists.sourceforge.net; Wed, 25 Mar 2026 16:26:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 9DE7C600AC; Wed, 25 Mar 2026 16:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44ED5C4CEF7; Wed, 25 Mar 2026 16:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774455964; bh=D1i5YPn3nepsXs93Y3yzjR5xi7srB1NJEGzhg5tNUh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H451FRpvxj6W/wUJepeJeqwD2HaLpYiOjcnAFQFLYd1zrf0tNxBCMYib/8sbgTnDl E9XUS9V2npYvDxkZZS6wzjIebTHBCFot6rljh7KiordjLkgymLg4Su5kHgItNO7aDw Mq+00OcZ5O9/oSXtH8GJeoRn5w26Yi67/PA75L1n1aedt/eCRnhwN1P7eOTPTbzUHv AhFtsLlxuOyxOpQkogHPmr6WejMj9icfWk7dvcHA5nuwykYzarrJPhz8yrZWyFU6uA JFRvSYFRKLnZZh1kx0utkkrbkptYIooI1udWvhMIXFVpEr92XBC84YrjaLmUDESEKj njVh1bSJYvbXw== Date: Wed, 25 Mar 2026 09:26:03 -0700 To: Andrey Albershteyn Message-ID: <20260325162603.GV6223@frogsfrogsfrogs> References: <20260319170231.1455553-1-aalbersh@kernel.org> <20260319170231.1455553-8-aalbersh@kernel.org> <20260325080021.GF952@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1w5R3a-0005sx-9h Subject: Re: [f2fs-dev] [PATCH v5 07/25] iomap: introduce IOMAP_F_FSVERITY and teach writeback to handle fsverity X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Darrick J. Wong via Linux-f2fs-devel" Reply-To: "Darrick J. Wong" Cc: fsverity@lists.linux.dev, ebiggers@kernel.org, Andrey Albershteyn , linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Christoph Hellwig , linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Wed, Mar 25, 2026 at 01:38:07PM +0100, Andrey Albershteyn wrote: > On 2026-03-25 09:00:21, Christoph Hellwig wrote: > > > @@ -353,9 +353,16 @@ static inline bool iomap_block_needs_zeroing(const struct iomap_iter *iter, > > > { > > > const struct iomap *srcmap = iomap_iter_srcmap(iter); > > > > > > - return srcmap->type != IOMAP_MAPPED || > > > - (srcmap->flags & IOMAP_F_NEW) || > > > - pos >= i_size_read(iter->inode); > > > + if (srcmap->type != IOMAP_MAPPED) > > > + return true; > > > + > > > + if (srcmap->flags & IOMAP_F_NEW) > > > + return true; > > > + > > > + if (srcmap->flags & IOMAP_F_FSVERITY) > > > + return false; > > > + > > > + return pos >= i_size_read(iter->inode); > > > > This might be a good time to document the various reasons for needing > > zeroing. > > something like this? > > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -344,9 +344,27 @@ static inline bool iomap_block_needs_zeroing(const struct iomap_iter *iter, > { > const struct iomap *srcmap = iomap_iter_srcmap(iter); > > - return srcmap->type != IOMAP_MAPPED || > - (srcmap->flags & IOMAP_F_NEW) || > - pos >= i_size_read(iter->inode); > + /* > + * If this block is not mapped, we don't have any backing blocks to read > + * yet /* If this block has not been written, there's nothing to read */ > + */ > + if (srcmap->type != IOMAP_MAPPED) > + return true; > + > + /* > + * This block just got allocated and does not contain any meaningful data > + */ /* Newly allocated blocks have not been written */ Otherwise looks good to me. --D > + if (srcmap->flags & IOMAP_F_NEW) > + return true; > + > + /* > + * fsverity metadata is stored past i_size, we need to read it instead of > + * zeroing > + */ > + if (srcmap->flags & IOMAP_F_FSVERITY) > + return false; > + > + return pos >= i_size_read(iter->inode); > } > > > > > > +/* > > > + * IO happens beyond inode EOF, fsverity metadata is stored there > > > + */ > > > +#define IOMAP_F_FSVERITY (1U << 10) > > > > This comment feels a bit too sparse. Here is my interpretation of what > > this flag does: > > > > /* > > * Indicates reads and writes of fsverity metadata. > > * > > * Fsverity metadata is stored after the regular file data and thus beyond > > * i_size. > > */ > > Thanks! I will update it > > -- > - Andrey > > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel