btrfs: replace readpage_end_io_hook with direct calls
Don't call readpage_end_io_hook for the btree inode. Instead of relying on indirect calls to implement metadata buffer validation simply check if the inode whose page we are processing equals the btree inode. If it does call the necessary function. This is an improvement in 2 directions: 1. We aren't paying the penalty of indirect calls in a post-speculation attacks world. 2. The function is now named more explicitly so it's obvious what's going on This is in preparation to removing struct extent_io_ops altogether. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
9c2b4e0347
commit
9a446d6a9f
@@ -2832,9 +2832,8 @@ zeroit:
|
||||
* if there's a match, we allow the bio to finish. If not, the code in
|
||||
* extent_io.c will try to find good copies for us.
|
||||
*/
|
||||
static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
|
||||
u64 phy_offset, struct page *page,
|
||||
u64 start, u64 end, int mirror)
|
||||
int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u64 phy_offset,
|
||||
struct page *page, u64 start, u64 end, int mirror)
|
||||
{
|
||||
size_t offset = start - page_offset(page);
|
||||
struct inode *inode = page->mapping->host;
|
||||
@@ -10261,7 +10260,7 @@ static const struct file_operations btrfs_dir_file_operations = {
|
||||
static const struct extent_io_ops btrfs_extent_io_ops = {
|
||||
/* mandatory callbacks */
|
||||
.submit_bio_hook = btrfs_submit_bio_hook,
|
||||
.readpage_end_io_hook = btrfs_readpage_end_io_hook,
|
||||
.readpage_end_io_hook = NULL
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user