From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Biggers Date: Wed, 5 Apr 2023 18:16:00 +0000 Subject: [Cluster-devel] [PATCH v2 21/23] xfs: handle merkle tree block size != fs blocksize != PAGE_SIZE In-Reply-To: <20230405163847.GG303486@frogsfrogsfrogs> References: <20230404145319.2057051-1-aalbersh@redhat.com> <20230404145319.2057051-22-aalbersh@redhat.com> <20230404163602.GC109974@frogsfrogsfrogs> <20230405160221.he76fb5b45dud6du@aalbersh.remote.csb> <20230405163847.GG303486@frogsfrogsfrogs> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, Apr 05, 2023 at 09:38:47AM -0700, Darrick J. Wong wrote: > > The merkle tree pages are dropped after verification. When page is > > dropped xfs_buf is marked as verified. If fs-verity wants to > > verify again it will get the same verified buffer. If buffer is > > evicted it won't have verified state. > > > > So, with enough memory pressure buffers will be dropped and need to > > be reverified. > > Please excuse me if this was discussed and rejected long ago, but > perhaps fsverity should try to hang on to the merkle tree pages that > this function returns for as long as possible until reclaim comes for > them? > > With the merkle tree page lifetimes extended, you then don't need to > attach the xfs_buf to page->private, nor does xfs have to extend the > buffer cache to stash XBF_VERITY_CHECKED. Well, all the other filesystems that support fsverity (ext4, f2fs, and btrfs) just cache the Merkle tree pages in the inode's page cache. It's an approach that I know some people aren't a fan of, but it's efficient and it works. We could certainly think about moving to a design where fs/verity/ asks the filesystem to just *read* a Merkle tree block, without adding it to a cache, and then fs/verity/ implements the caching itself. That would require some large changes to each filesystem, though, unless we were to double-cache the Merkle tree blocks which would be inefficient. So it feels like continuing to have the filesystem (not fs/verity/) be responsible for the cache is the best way to allow XFS to do things a bit differently, without regressing the other filesystems. I'm interested in hearing any other proposals, though. - Eric