aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-02-17 10:24:29 -0500
committerDavid Sterba <dsterba@suse.com>2017-02-28 08:29:24 -0500
commit20a7db8ab3f2057a518448b1728d504ffadef65e (patch)
tree09d4f1e8acb66b0f935306cbee04b572824df95c
parent20c9801d393d9f077c476f40440b481daaccb9d6 (diff)
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 <dsterba@suse.com>
-rw-r--r--fs/btrfs/disk-io.c2
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/btrfs/extent_io.h2
-rw-r--r--fs/btrfs/inode.c7
4 files changed, 10 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 60d4f1b210d7..cad47ece2fdf 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4658,7 +4658,7 @@ static const struct extent_io_ops btree_extent_io_ops = {
4658 .readpage_end_io_hook = btree_readpage_end_io_hook, 4658 .readpage_end_io_hook = btree_readpage_end_io_hook,
4659 /* note we're sharing with inode.c for the merge bio hook */ 4659 /* note we're sharing with inode.c for the merge bio hook */
4660 .merge_bio_hook = btrfs_merge_bio_hook, 4660 .merge_bio_hook = btrfs_merge_bio_hook,
4661 .readpage_io_failed_hook = btree_io_failed_hook,
4661 4662
4662 /* optional callbacks */ 4663 /* optional callbacks */
4663 .readpage_io_failed_hook = btree_io_failed_hook,
4664}; 4664};
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 0786985a8cc5..28e81922a21c 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2581,7 +2581,7 @@ static void end_bio_extent_readpage(struct bio *bio)
2581 if (likely(uptodate)) 2581 if (likely(uptodate))
2582 goto readpage_ok; 2582 goto readpage_ok;
2583 2583
2584 if (tree->ops && tree->ops->readpage_io_failed_hook) { 2584 if (tree->ops) {
2585 ret = tree->ops->readpage_io_failed_hook(page, mirror); 2585 ret = tree->ops->readpage_io_failed_hook(page, mirror);
2586 if (!ret && !bio->bi_error) 2586 if (!ret && !bio->bi_error)
2587 uptodate = 1; 2587 uptodate = 1;
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 1f8478dc9f8e..3e4fad4a909d 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -103,6 +103,7 @@ struct extent_io_ops {
103 int (*merge_bio_hook)(struct page *page, unsigned long offset, 103 int (*merge_bio_hook)(struct page *page, unsigned long offset,
104 size_t size, struct bio *bio, 104 size_t size, struct bio *bio,
105 unsigned long bio_flags); 105 unsigned long bio_flags);
106 int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
106 107
107 /* 108 /*
108 * Optional hooks, called if the pointer is not NULL 109 * Optional hooks, called if the pointer is not NULL
@@ -110,7 +111,6 @@ struct extent_io_ops {
110 int (*fill_delalloc)(struct inode *inode, struct page *locked_page, 111 int (*fill_delalloc)(struct inode *inode, struct page *locked_page,
111 u64 start, u64 end, int *page_started, 112 u64 start, u64 end, int *page_started,
112 unsigned long *nr_written); 113 unsigned long *nr_written);
113 int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
114 114
115 int (*writepage_start_hook)(struct page *page, u64 start, u64 end); 115 int (*writepage_start_hook)(struct page *page, u64 start, u64 end);
116 void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, 116 void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3b327c8cfb16..ca1995cfd8e9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -10509,6 +10509,12 @@ out_inode:
10509 10509
10510} 10510}
10511 10511
10512__attribute__((const))
10513static int dummy_readpage_io_failed_hook(struct page *page, int failed_mirror)
10514{
10515 return 0;
10516}
10517
10512static const struct inode_operations btrfs_dir_inode_operations = { 10518static const struct inode_operations btrfs_dir_inode_operations = {
10513 .getattr = btrfs_getattr, 10519 .getattr = btrfs_getattr,
10514 .lookup = btrfs_lookup, 10520 .lookup = btrfs_lookup,
@@ -10551,6 +10557,7 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
10551 .submit_bio_hook = btrfs_submit_bio_hook, 10557 .submit_bio_hook = btrfs_submit_bio_hook,
10552 .readpage_end_io_hook = btrfs_readpage_end_io_hook, 10558 .readpage_end_io_hook = btrfs_readpage_end_io_hook,
10553 .merge_bio_hook = btrfs_merge_bio_hook, 10559 .merge_bio_hook = btrfs_merge_bio_hook,
10560 .readpage_io_failed_hook = dummy_readpage_io_failed_hook,
10554 10561
10555 /* optional callbacks */ 10562 /* optional callbacks */
10556 .fill_delalloc = run_delalloc_range, 10563 .fill_delalloc = run_delalloc_range,