Skip to content

Commit

Permalink
fs/buffer.c: use b_folio for fsverity work
Browse files Browse the repository at this point in the history
Use b_folio now that it exists.  This removes an unnecessary call to
compound_head().  No actual change in behavior.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Eric Biggers <[email protected]>
  • Loading branch information
ebiggers committed Mar 28, 2023
1 parent 197b6b6 commit 8b7d3fe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,19 @@ static void verify_bh(struct work_struct *work)
struct buffer_head *bh = ctx->bh;
bool valid;

valid = fsverity_verify_blocks(page_folio(bh->b_page), bh->b_size,
bh_offset(bh));
valid = fsverity_verify_blocks(bh->b_folio, bh->b_size, bh_offset(bh));
end_buffer_async_read(bh, valid);
kfree(ctx);
}

static bool need_fsverity(struct buffer_head *bh)
{
struct page *page = bh->b_page;
struct inode *inode = page->mapping->host;
struct folio *folio = bh->b_folio;
struct inode *inode = folio->mapping->host;

return fsverity_active(inode) &&
/* needed by ext4 */
page->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
folio->index < DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
}

static void decrypt_bh(struct work_struct *work)
Expand Down

0 comments on commit 8b7d3fe

Please sign in to comment.