summaryrefslogtreecommitdiff
path: root/fs/verity/open.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-12-23 23:36:29 +0300
committerEric Biggers <ebiggers@google.com>2023-01-10 06:05:54 +0300
commit9098f36b739db9a77d24b7c302dcb9d3fe987308 (patch)
tree6eab452a3fd714bfb23088ef2f642468f73b7130 /fs/verity/open.c
parent284d5db5f99efa9e3549eb3cba39379d48879db1 (diff)
downloadlinux-9098f36b739db9a77d24b7c302dcb9d3fe987308.tar.xz
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
Diffstat (limited to 'fs/verity/open.c')
-rw-r--r--fs/verity/open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/verity/open.c b/fs/verity/open.c
index 83ccc3c13736..e356eefb54d7 100644
--- a/fs/verity/open.c
+++ b/fs/verity/open.c
@@ -7,6 +7,7 @@
#include "fsverity_private.h"
+#include <linux/mm.h>
#include <linux/slab.h>
static struct kmem_cache *fsverity_info_cachep;
@@ -97,7 +98,6 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,
params->log_arity;
blocks_in_level[params->num_levels++] = blocks;
}
- params->level0_blocks = blocks_in_level[0];
/* Compute the starting block of each level */
offset = 0;
@@ -118,6 +118,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,
}
params->tree_size = offset << log_blocksize;
+ params->tree_pages = PAGE_ALIGN(params->tree_size) >> PAGE_SHIFT;
return 0;
out_err: