btrfs: make repair_io_failure take btrfs_inode
authorNikolay Borisov <nborisov@suse.com>
Mon, 20 Feb 2017 11:50:55 +0000 (13:50 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 28 Feb 2017 10:30:09 +0000 (11:30 +0100)
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/scrub.c

index 0e73e48a9c4cdef65252fd6cde61256ce8ab0efd..e99e8dad3cc7a43313a2dc1fd683ab0bb925b425 100644 (file)
@@ -1992,10 +1992,11 @@ int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec)
  * currently, there can be no more than two copies of every data bit. thus,
  * exactly one rewrite is required.
  */
-int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical,
-                     struct page *page, unsigned int pg_offset, int mirror_num)
+int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length,
+               u64 logical, struct page *page,
+               unsigned int pg_offset, int mirror_num)
 {
-       struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info;
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
        struct bio *bio;
        struct btrfs_device *dev;
        u64 map_length = 0;
@@ -2054,7 +2055,7 @@ int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical,
 
        btrfs_info_rl_in_rcu(fs_info,
                "read error corrected: ino %llu off %llu (dev %s sector %llu)",
-                                 btrfs_ino(BTRFS_I(inode)), start,
+                                 btrfs_ino(inode), start,
                                  rcu_str_deref(dev->name), sector);
        btrfs_bio_counter_dec(fs_info);
        bio_put(bio);
@@ -2074,7 +2075,7 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info,
        for (i = 0; i < num_pages; i++) {
                struct page *p = eb->pages[i];
 
-               ret = repair_io_failure(fs_info->btree_inode, start,
+               ret = repair_io_failure(BTRFS_I(fs_info->btree_inode), start,
                                        PAGE_SIZE, start, p,
                                        start - page_offset(p), mirror_num);
                if (ret)
@@ -2133,7 +2134,7 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page,
                num_copies = btrfs_num_copies(fs_info, failrec->logical,
                                              failrec->len);
                if (num_copies > 1)  {
-                       repair_io_failure(inode, start, failrec->len,
+                       repair_io_failure(BTRFS_I(inode), start, failrec->len,
                                          failrec->logical, page,
                                          pg_offset, failrec->failed_mirror);
                }
index 5b4132a9093a49120477eebdf59050fea3046755..039a6daa392bd244f56ab760b73ec30422686817 100644 (file)
@@ -451,10 +451,11 @@ struct bio *btrfs_io_bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs);
 struct bio *btrfs_bio_clone(struct bio *bio, gfp_t gfp_mask);
 
 struct btrfs_fs_info;
+struct btrfs_inode;
 
-int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical,
-                     struct page *page, unsigned int pg_offset,
-                     int mirror_num);
+int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length,
+               u64 logical, struct page *page,
+               unsigned int pg_offset, int mirror_num);
 int clean_io_failure(struct inode *inode, u64 start, struct page *page,
                     unsigned int pg_offset);
 void end_extent_writepage(struct page *page, int err, u64 start, u64 end);
@@ -480,7 +481,6 @@ struct io_failure_record {
        int in_validation;
 };
 
-struct btrfs_inode;
 
 void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end);
 int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
index 82d873406aa3214d140e6001ce7a0d8b2ac09d41..bdf58b0eaef83790541a93f4b380a865d0740806 100644 (file)
@@ -731,7 +731,7 @@ static int scrub_fixup_readpage(u64 inum, u64 offset, u64 root, void *fixup_ctx)
                        ret = -EIO;
                        goto out;
                }
-               ret = repair_io_failure(inode, offset, PAGE_SIZE,
+               ret = repair_io_failure(BTRFS_I(inode), offset, PAGE_SIZE,
                                        fixup->logical, page,
                                        offset - page_offset(page),
                                        fixup->mirror_num);