Commit b30cb441 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make clean_io_failure take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9d4f7f8a
...@@ -2090,23 +2090,23 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info, ...@@ -2090,23 +2090,23 @@ int repair_eb_io_failure(struct btrfs_fs_info *fs_info,
* each time an IO finishes, we do a fast check in the IO failure tree * each time an IO finishes, we do a fast check in the IO failure tree
* to see if we need to process or clean up an io_failure_record * to see if we need to process or clean up an io_failure_record
*/ */
int clean_io_failure(struct inode *inode, u64 start, struct page *page, int clean_io_failure(struct btrfs_inode *inode, u64 start, struct page *page,
unsigned int pg_offset) unsigned int pg_offset)
{ {
u64 private; u64 private;
struct io_failure_record *failrec; struct io_failure_record *failrec;
struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
struct extent_state *state; struct extent_state *state;
int num_copies; int num_copies;
int ret; int ret;
private = 0; private = 0;
ret = count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, ret = count_range_bits(&inode->io_failure_tree, &private,
(u64)-1, 1, EXTENT_DIRTY, 0); (u64)-1, 1, EXTENT_DIRTY, 0);
if (!ret) if (!ret)
return 0; return 0;
ret = get_state_failrec(&BTRFS_I(inode)->io_failure_tree, start, ret = get_state_failrec(&inode->io_failure_tree, start,
&failrec); &failrec);
if (ret) if (ret)
return 0; return 0;
...@@ -2123,25 +2123,25 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page, ...@@ -2123,25 +2123,25 @@ int clean_io_failure(struct inode *inode, u64 start, struct page *page,
if (fs_info->sb->s_flags & MS_RDONLY) if (fs_info->sb->s_flags & MS_RDONLY)
goto out; goto out;
spin_lock(&BTRFS_I(inode)->io_tree.lock); spin_lock(&inode->io_tree.lock);
state = find_first_extent_bit_state(&BTRFS_I(inode)->io_tree, state = find_first_extent_bit_state(&inode->io_tree,
failrec->start, failrec->start,
EXTENT_LOCKED); EXTENT_LOCKED);
spin_unlock(&BTRFS_I(inode)->io_tree.lock); spin_unlock(&inode->io_tree.lock);
if (state && state->start <= failrec->start && if (state && state->start <= failrec->start &&
state->end >= failrec->start + failrec->len - 1) { state->end >= failrec->start + failrec->len - 1) {
num_copies = btrfs_num_copies(fs_info, failrec->logical, num_copies = btrfs_num_copies(fs_info, failrec->logical,
failrec->len); failrec->len);
if (num_copies > 1) { if (num_copies > 1) {
repair_io_failure(BTRFS_I(inode), start, failrec->len, repair_io_failure(inode, start, failrec->len,
failrec->logical, page, failrec->logical, page,
pg_offset, failrec->failed_mirror); pg_offset, failrec->failed_mirror);
} }
} }
out: out:
free_io_failure(BTRFS_I(inode), failrec); free_io_failure(inode, failrec);
return 0; return 0;
} }
...@@ -2577,7 +2577,8 @@ static void end_bio_extent_readpage(struct bio *bio) ...@@ -2577,7 +2577,8 @@ static void end_bio_extent_readpage(struct bio *bio)
if (ret) if (ret)
uptodate = 0; uptodate = 0;
else else
clean_io_failure(inode, start, page, 0); clean_io_failure(BTRFS_I(inode), start,
page, 0);
} }
if (likely(uptodate)) if (likely(uptodate))
......
...@@ -456,8 +456,8 @@ struct btrfs_inode; ...@@ -456,8 +456,8 @@ struct btrfs_inode;
int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length, int repair_io_failure(struct btrfs_inode *inode, u64 start, u64 length,
u64 logical, struct page *page, u64 logical, struct page *page,
unsigned int pg_offset, int mirror_num); unsigned int pg_offset, int mirror_num);
int clean_io_failure(struct inode *inode, u64 start, struct page *page, int clean_io_failure(struct btrfs_inode *inode, u64 start,
unsigned int pg_offset); struct page *page, unsigned int pg_offset);
void end_extent_writepage(struct page *page, int err, u64 start, u64 end); void end_extent_writepage(struct page *page, int err, u64 start, u64 end);
int repair_eb_io_failure(struct btrfs_fs_info *fs_info, int repair_eb_io_failure(struct btrfs_fs_info *fs_info,
struct extent_buffer *eb, int mirror_num); struct extent_buffer *eb, int mirror_num);
......
...@@ -7914,7 +7914,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) ...@@ -7914,7 +7914,7 @@ static void btrfs_retry_endio_nocsum(struct bio *bio)
done->uptodate = 1; done->uptodate = 1;
bio_for_each_segment_all(bvec, bio, i) bio_for_each_segment_all(bvec, bio, i)
clean_io_failure(done->inode, done->start, bvec->bv_page, 0); clean_io_failure(BTRFS_I(done->inode), done->start, bvec->bv_page, 0);
end: end:
complete(&done->done); complete(&done->done);
bio_put(bio); bio_put(bio);
...@@ -8000,7 +8000,7 @@ static void btrfs_retry_endio(struct bio *bio) ...@@ -8000,7 +8000,7 @@ static void btrfs_retry_endio(struct bio *bio)
bvec->bv_page, bvec->bv_offset, bvec->bv_page, bvec->bv_offset,
done->start, bvec->bv_len); done->start, bvec->bv_len);
if (!ret) if (!ret)
clean_io_failure(done->inode, done->start, clean_io_failure(BTRFS_I(done->inode), done->start,
bvec->bv_page, bvec->bv_offset); bvec->bv_page, bvec->bv_offset);
else else
uptodate = 0; uptodate = 0;
......
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