diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-02-02 07:06:35 +0100 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-02-02 17:15:26 -0800 |
| commit | 47bc2ac9b63da87362ce890543d8d955e0ccc36a (patch) | |
| tree | 29911e7adbdc938685f2029f80b58fc1d82fc765 /fs/ext4 | |
| parent | 7e36e044958da7d2cbff391dcfda405f5472ae1d (diff) | |
fsverity: push out fsverity_info lookup
Pass a struct fsverity_info to the verification and readahead helpers,
and push the lookup into the callers. Right now this is a very dumb
almost mechanic move that open codes a lot of fsverity_info_addr() calls
in the file systems. The subsequent patches will clean this up.
This prepares for reducing the number of fsverity_info lookups, which
will allow to amortize them better when using a more expensive lookup
method.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Acked-by: David Sterba <dsterba@suse.com> # btrfs
Link: https://lore.kernel.org/r/20260202060754.270269-7-hch@lst.de
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'fs/ext4')
| -rw-r--r-- | fs/ext4/readpage.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c index 3049a66a05c8..b0a3c9236368 100644 --- a/fs/ext4/readpage.c +++ b/fs/ext4/readpage.c @@ -97,6 +97,7 @@ static void verity_work(struct work_struct *work) struct bio_post_read_ctx *ctx = container_of(work, struct bio_post_read_ctx, work); struct bio *bio = ctx->bio; + struct inode *inode = bio_first_folio_all(bio)->mapping->host; /* * fsverity_verify_bio() may call readahead() again, and although verity @@ -109,7 +110,7 @@ static void verity_work(struct work_struct *work) mempool_free(ctx, bio_post_read_ctx_pool); bio->bi_private = NULL; - fsverity_verify_bio(bio); + fsverity_verify_bio(*fsverity_info_addr(inode), bio); __read_end_io(bio); } @@ -331,7 +332,9 @@ static int ext4_mpage_readpages(struct inode *inode, folio_size(folio)); if (first_hole == 0) { if (ext4_need_verity(inode, folio->index) && - !fsverity_verify_folio(folio)) + !fsverity_verify_folio( + *fsverity_info_addr(inode), + folio)) goto set_error_page; folio_end_read(folio, true); continue; @@ -409,7 +412,8 @@ int ext4_read_folio(struct file *file, struct folio *folio) } if (ext4_need_verity(inode, folio->index)) - fsverity_readahead(inode, folio->index, folio_nr_pages(folio)); + fsverity_readahead(*fsverity_info_addr(inode), folio->index, + folio_nr_pages(folio)); return ext4_mpage_readpages(inode, NULL, folio); } @@ -422,8 +426,8 @@ void ext4_readahead(struct readahead_control *rac) return; if (ext4_need_verity(inode, readahead_index(rac))) - fsverity_readahead(inode, readahead_index(rac), - readahead_count(rac)); + fsverity_readahead(*fsverity_info_addr(inode), + readahead_index(rac), readahead_count(rac)); ext4_mpage_readpages(inode, rac, NULL); } |
