mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
btrfs: factor out a btrfs_verify_page helper
[ Upstream commited9ee98ecb
] Split all the conditionals for the fsverity calls in end_page_read into a btrfs_verify_page helper to keep the code readable and make additional refactoring easier. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Stable-dep-of:2c14f0ffdd
("btrfs: fix fsverify read error handling in end_page_read") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9622940625
commit
c42d836e2e
1 changed files with 10 additions and 5 deletions
|
@ -478,6 +478,15 @@ void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
|
|||
start, end, page_ops, NULL);
|
||||
}
|
||||
|
||||
static bool btrfs_verify_page(struct page *page, u64 start)
|
||||
{
|
||||
if (!fsverity_active(page->mapping->host) ||
|
||||
PageError(page) || PageUptodate(page) ||
|
||||
start >= i_size_read(page->mapping->host))
|
||||
return true;
|
||||
return fsverity_verify_page(page);
|
||||
}
|
||||
|
||||
static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(page->mapping->host->i_sb);
|
||||
|
@ -486,11 +495,7 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len)
|
|||
start + len <= page_offset(page) + PAGE_SIZE);
|
||||
|
||||
if (uptodate) {
|
||||
if (fsverity_active(page->mapping->host) &&
|
||||
!PageError(page) &&
|
||||
!PageUptodate(page) &&
|
||||
start < i_size_read(page->mapping->host) &&
|
||||
!fsverity_verify_page(page)) {
|
||||
if (!btrfs_verify_page(page, start)) {
|
||||
btrfs_page_set_error(fs_info, page, start, len);
|
||||
} else {
|
||||
btrfs_page_set_uptodate(fs_info, page, start, len);
|
||||
|
|
Loading…
Reference in a new issue