Commit 4ac1f4ac authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make free_io_failure take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 2cff578c
...@@ -1959,11 +1959,11 @@ static void check_page_uptodate(struct extent_io_tree *tree, struct page *page) ...@@ -1959,11 +1959,11 @@ static void check_page_uptodate(struct extent_io_tree *tree, struct page *page)
SetPageUptodate(page); SetPageUptodate(page);
} }
int free_io_failure(struct inode *inode, struct io_failure_record *rec) int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec)
{ {
int ret; int ret;
int err = 0; int err = 0;
struct extent_io_tree *failure_tree = &BTRFS_I(inode)->io_failure_tree; struct extent_io_tree *failure_tree = &inode->io_failure_tree;
set_state_failrec(failure_tree, rec->start, NULL); set_state_failrec(failure_tree, rec->start, NULL);
ret = clear_extent_bits(failure_tree, rec->start, ret = clear_extent_bits(failure_tree, rec->start,
...@@ -1972,7 +1972,7 @@ int free_io_failure(struct inode *inode, struct io_failure_record *rec) ...@@ -1972,7 +1972,7 @@ int free_io_failure(struct inode *inode, struct io_failure_record *rec)
if (ret) if (ret)
err = ret; err = ret;
ret = clear_extent_bits(&BTRFS_I(inode)->io_tree, rec->start, ret = clear_extent_bits(&inode->io_tree, rec->start,
rec->start + rec->len - 1, rec->start + rec->len - 1,
EXTENT_DAMAGED); EXTENT_DAMAGED);
if (ret && !err) if (ret && !err)
...@@ -2140,7 +2140,7 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page, ...@@ -2140,7 +2140,7 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page,
} }
out: out:
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
return 0; return 0;
} }
...@@ -2393,7 +2393,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ...@@ -2393,7 +2393,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
ret = btrfs_check_repairable(inode, failed_bio, failrec, failed_mirror); ret = btrfs_check_repairable(inode, failed_bio, failrec, failed_mirror);
if (!ret) { if (!ret) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
return -EIO; return -EIO;
} }
...@@ -2406,7 +2406,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ...@@ -2406,7 +2406,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
(int)phy_offset, failed_bio->bi_end_io, (int)phy_offset, failed_bio->bi_end_io,
NULL); NULL);
if (!bio) { if (!bio) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
return -EIO; return -EIO;
} }
bio_set_op_attrs(bio, REQ_OP_READ, read_mode); bio_set_op_attrs(bio, REQ_OP_READ, read_mode);
...@@ -2418,7 +2418,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ...@@ -2418,7 +2418,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
ret = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror, ret = tree->ops->submit_bio_hook(inode, bio, failrec->this_mirror,
failrec->bio_flags, 0); failrec->bio_flags, 0);
if (ret) { if (ret) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
bio_put(bio); bio_put(bio);
} }
......
...@@ -480,6 +480,8 @@ struct io_failure_record { ...@@ -480,6 +480,8 @@ struct io_failure_record {
int in_validation; int in_validation;
}; };
struct btrfs_inode;
void btrfs_free_io_failure_record(struct inode *inode, u64 start, u64 end); 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, int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
struct io_failure_record **failrec_ret); struct io_failure_record **failrec_ret);
...@@ -489,7 +491,7 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio, ...@@ -489,7 +491,7 @@ struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
struct io_failure_record *failrec, struct io_failure_record *failrec,
struct page *page, int pg_offset, int icsum, struct page *page, int pg_offset, int icsum,
bio_end_io_t *endio_func, void *data); bio_end_io_t *endio_func, void *data);
int free_io_failure(struct inode *inode, struct io_failure_record *rec); int free_io_failure(struct btrfs_inode *inode, struct io_failure_record *rec);
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
noinline u64 find_lock_delalloc_range(struct inode *inode, noinline u64 find_lock_delalloc_range(struct inode *inode,
struct extent_io_tree *tree, struct extent_io_tree *tree,
......
...@@ -7859,7 +7859,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, ...@@ -7859,7 +7859,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
ret = btrfs_check_dio_repairable(inode, failed_bio, failrec, ret = btrfs_check_dio_repairable(inode, failed_bio, failrec,
failed_mirror); failed_mirror);
if (!ret) { if (!ret) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
return -EIO; return -EIO;
} }
...@@ -7873,7 +7873,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, ...@@ -7873,7 +7873,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page, bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page,
pgoff, isector, repair_endio, repair_arg); pgoff, isector, repair_endio, repair_arg);
if (!bio) { if (!bio) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
return -EIO; return -EIO;
} }
bio_set_op_attrs(bio, REQ_OP_READ, read_mode); bio_set_op_attrs(bio, REQ_OP_READ, read_mode);
...@@ -7884,7 +7884,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio, ...@@ -7884,7 +7884,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
ret = submit_dio_repair_bio(inode, bio, failrec->this_mirror); ret = submit_dio_repair_bio(inode, bio, failrec->this_mirror);
if (ret) { if (ret) {
free_io_failure(inode, failrec); free_io_failure(BTRFS_I(inode), failrec);
bio_put(bio); bio_put(bio);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment