Skip to content

Commit 20a7db8

Browse files
committed
btrfs: add dummy callback for readpage_io_failed and drop checks
Make extent_io_ops::readpage_io_failed_hook callback mandatory and define a dummy function for btrfs_extent_io_ops. As the failed IO callback is not performance critical, the branch vs extra trade off does not hurt. Signed-off-by: David Sterba <[email protected]>
1 parent 20c9801 commit 20a7db8

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4658,7 +4658,7 @@ static const struct extent_io_ops btree_extent_io_ops = {
46584658
.readpage_end_io_hook = btree_readpage_end_io_hook,
46594659
/* note we're sharing with inode.c for the merge bio hook */
46604660
.merge_bio_hook = btrfs_merge_bio_hook,
4661+
.readpage_io_failed_hook = btree_io_failed_hook,
46614662

46624663
/* optional callbacks */
4663-
.readpage_io_failed_hook = btree_io_failed_hook,
46644664
};

fs/btrfs/extent_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,7 @@ static void end_bio_extent_readpage(struct bio *bio)
25812581
if (likely(uptodate))
25822582
goto readpage_ok;
25832583

2584-
if (tree->ops && tree->ops->readpage_io_failed_hook) {
2584+
if (tree->ops) {
25852585
ret = tree->ops->readpage_io_failed_hook(page, mirror);
25862586
if (!ret && !bio->bi_error)
25872587
uptodate = 1;

fs/btrfs/extent_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ struct extent_io_ops {
103103
int (*merge_bio_hook)(struct page *page, unsigned long offset,
104104
size_t size, struct bio *bio,
105105
unsigned long bio_flags);
106+
int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
106107

107108
/*
108109
* Optional hooks, called if the pointer is not NULL
109110
*/
110111
int (*fill_delalloc)(struct inode *inode, struct page *locked_page,
111112
u64 start, u64 end, int *page_started,
112113
unsigned long *nr_written);
113-
int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
114114

115115
int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
116116
void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,

fs/btrfs/inode.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10509,6 +10509,12 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
1050910509

1051010510
}
1051110511

10512+
__attribute__((const))
10513+
static int dummy_readpage_io_failed_hook(struct page *page, int failed_mirror)
10514+
{
10515+
return 0;
10516+
}
10517+
1051210518
static const struct inode_operations btrfs_dir_inode_operations = {
1051310519
.getattr = btrfs_getattr,
1051410520
.lookup = btrfs_lookup,
@@ -10551,6 +10557,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
1055110557
.submit_bio_hook = btrfs_submit_bio_hook,
1055210558
.readpage_end_io_hook = btrfs_readpage_end_io_hook,
1055310559
.merge_bio_hook = btrfs_merge_bio_hook,
10560+
.readpage_io_failed_hook = dummy_readpage_io_failed_hook,
1055410561

1055510562
/* optional callbacks */
1055610563
.fill_delalloc = run_delalloc_range,

0 commit comments

Comments
 (0)