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/f2fs | |
| 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/f2fs')
| -rw-r--r-- | fs/f2fs/compress.c | 4 | ||||
| -rw-r--r-- | fs/f2fs/data.c | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 40a62f1dee4d..3de4a7e66959 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1814,7 +1814,9 @@ static void f2fs_verify_cluster(struct work_struct *work) if (!rpage) continue; - if (fsverity_verify_page(rpage)) + if (fsverity_verify_page( + *fsverity_info_addr(rpage->mapping->host), + rpage)) SetPageUptodate(rpage); else ClearPageUptodate(rpage); diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 58d8a311ef2c..3593208c99db 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -185,15 +185,19 @@ static void f2fs_verify_bio(struct work_struct *work) bio_for_each_folio_all(fi, bio) { struct folio *folio = fi.folio; + struct fsverity_info *vi = + *fsverity_info_addr(folio->mapping->host); if (!f2fs_is_compressed_page(folio) && - !fsverity_verify_page(&folio->page)) { + !fsverity_verify_page(vi, &folio->page)) { bio->bi_status = BLK_STS_IOERR; break; } } } else { - fsverity_verify_bio(bio); + struct inode *inode = bio_first_folio_all(bio)->mapping->host; + + fsverity_verify_bio(*fsverity_info_addr(inode), bio); } f2fs_finish_read_bio(bio, true); @@ -2121,7 +2125,9 @@ got_it: zero_out: folio_zero_segment(folio, 0, folio_size(folio)); if (f2fs_need_verity(inode, index) && - !fsverity_verify_folio(folio)) { + !fsverity_verify_folio( + *fsverity_info_addr(folio->mapping->host), + folio)) { ret = -EIO; goto out; } @@ -2475,7 +2481,8 @@ static int f2fs_read_data_folio(struct file *file, struct folio *folio) } if (f2fs_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 f2fs_mpage_readpages(inode, NULL, folio); } @@ -2493,8 +2500,8 @@ static void f2fs_readahead(struct readahead_control *rac) return; if (f2fs_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)); f2fs_mpage_readpages(inode, rac, NULL); } |
