fsverity: simplify Merkle tree readahead size calculation
authorEric Biggers <ebiggers@google.com>
Fri, 23 Dec 2022 20:36:29 +0000 (12:36 -0800)
committerEric Biggers <ebiggers@google.com>
Tue, 10 Jan 2023 03:05:54 +0000 (19:05 -0800)
commit9098f36b739db9a77d24b7c302dcb9d3fe987308
tree6eab452a3fd714bfb23088ef2f642468f73b7130
parent284d5db5f99efa9e3549eb3cba39379d48879db1
fsverity: simplify Merkle tree readahead size calculation

First, calculate max_ra_pages more efficiently by using the bio size.

Second, calculate the number of readahead pages from the hash page
index, instead of calculating it ahead of time using the data page
index.  This ends up being a bit simpler, especially since level 0 is
last in the tree, so we can just limit the readahead to the tree size.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Tested-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://lore.kernel.org/r/20221223203638.41293-3-ebiggers@kernel.org
fs/verity/fsverity_private.h
fs/verity/open.c
fs/verity/verify.c