Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 F2E2F37F8AD for ; Fri, 23 Jan 2026 05:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769145279; cv=none; b=DTKL/bpmZJxKTYCRAjWRmjqcDj3H+qxWvKW64377/6STCQetJjptrFx9Tg++nk4sdYB3L9gIALN25wzgAp6CeDYaSL+T3QmXvbRx+gqK2V2X4cHlH7VEziBKyIFFFZ1jk0gWKfAITgteUIfwWdxI0JF3voEsgvIaVI9Q60b4gY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769145279; c=relaxed/simple; bh=S2k3klXik6+I/jlQdoWxLlXNPXFYXFCH58KKTyU8OfQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lex0KLZ5Bd/LOo0M4OLIrBSfh7XLtMXJvzYoazq1rB843FHhRTiZPB3FMrY5EUQD6Qk4pIgsepv3YRuKcBhwUoy+Ij4bYdz3AcB42pVo46gQFOjh2dyZYPPMQV3oinhQBg81f7qGrQ9PA7sadDbauTcwpWSNssF78yY+ixualbQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 3175E227AAE; Fri, 23 Jan 2026 06:14:30 +0100 (CET) Date: Fri, 23 Jan 2026 06:14:29 +0100 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Christoph Hellwig , Eric Biggers , Al Viro , Christian Brauner , Jan Kara , David Sterba , Theodore Ts'o , Jaegeuk Kim , Chao Yu , Andrey Albershteyn , "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, fsverity@lists.linux.dev Subject: Re: [PATCH 05/11] fsverity: kick off hash readahead at data I/O submission time Message-ID: <20260123051429.GB24123@lst.de> References: <20260122082214.452153-1-hch@lst.de> <20260122082214.452153-6-hch@lst.de> <20260122214227.GE5910@frogsfrogsfrogs> 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: <20260122214227.GE5910@frogsfrogsfrogs> User-Agent: Mutt/1.5.17 (2007-11-01) On Thu, Jan 22, 2026 at 01:42:27PM -0800, Darrick J. Wong wrote: > > + if (first_folio) { > > + if (ext4_need_verity(inode, folio->index)) > > + fsverity_readahead(folio, nr_pages); > > Ok, so here ext4 is trying to read a data page into memory, so we > initiate readahead on the merkle tree block(s) for that data page. Yes. > > + __fsverity_readahead(inode, vi, offset, last_index - index + 1); > > I went "Huh??" here until I realized that this is the function that > reads merkle tree content on behalf of some ioctl, so this is merely > starting readahead for that. Not sure anyone cares about throughput of > FS_VERITY_METADATA_TYPE_MERKLE_TREE but sure why not. It is trivial to provide and will make the ioctl read much faster. > > + const struct merkle_tree_params *params = &vi->tree_params; > > + u64 start_hidx = data_start_pos >> params->log_blocksize; > > + u64 end_hidx = (data_start_pos + ((nr_pages - 1) << PAGE_SHIFT)) >> > > + params->log_blocksize; > > I really wish these unit conversions had proper types and helpers > instead of this multiline to read shifting stuff. Oh well, you didn't > write it this way, you're just slicing and dicing. Agreed. Just not feeling like turning everything totally upside down right now :) > So if I read this correctly, we're initiating readahead of merkle tree > (leaf) data for the file data range starting at data_start_pos and > running for (nr_pages< merkle tree and initiating readahead for the corresponding interior > nodes until we get to the root? Yes. That's a difference to the old code that just did readahead for the leaf nodes.