mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 01:29:02 +02:00
btrfs: pass btrfs_inode to btrfs_repair_one_sector
The function is for internal interfaces so we should use the btrfs_inode. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c5ca391b0d
commit
d8f9268ece
4 changed files with 11 additions and 12 deletions
|
|
@ -194,7 +194,7 @@ static void end_compressed_bio_read(struct btrfs_bio *bbio)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
refcount_inc(&cb->pending_ios);
|
refcount_inc(&cb->pending_ios);
|
||||||
ret = btrfs_repair_one_sector(inode, bbio, offset,
|
ret = btrfs_repair_one_sector(BTRFS_I(inode), bbio, offset,
|
||||||
bv.bv_page, bv.bv_offset,
|
bv.bv_page, bv.bv_offset,
|
||||||
true);
|
true);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
||||||
|
|
@ -795,13 +795,13 @@ static struct io_failure_record *btrfs_get_io_failure_record(struct inode *inode
|
||||||
return failrec;
|
return failrec;
|
||||||
}
|
}
|
||||||
|
|
||||||
int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
int btrfs_repair_one_sector(struct btrfs_inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
u32 bio_offset, struct page *page, unsigned int pgoff,
|
u32 bio_offset, struct page *page, unsigned int pgoff,
|
||||||
bool submit_buffered)
|
bool submit_buffered)
|
||||||
{
|
{
|
||||||
u64 start = failed_bbio->file_offset + bio_offset;
|
u64 start = failed_bbio->file_offset + bio_offset;
|
||||||
struct io_failure_record *failrec;
|
struct io_failure_record *failrec;
|
||||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||||
struct bio *failed_bio = &failed_bbio->bio;
|
struct bio *failed_bio = &failed_bbio->bio;
|
||||||
const int icsum = bio_offset >> fs_info->sectorsize_bits;
|
const int icsum = bio_offset >> fs_info->sectorsize_bits;
|
||||||
struct bio *repair_bio;
|
struct bio *repair_bio;
|
||||||
|
|
@ -812,7 +812,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
|
|
||||||
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
|
BUG_ON(bio_op(failed_bio) == REQ_OP_WRITE);
|
||||||
|
|
||||||
failrec = btrfs_get_io_failure_record(inode, failed_bbio, bio_offset);
|
failrec = btrfs_get_io_failure_record(&inode->vfs_inode, failed_bbio, bio_offset);
|
||||||
if (IS_ERR(failrec))
|
if (IS_ERR(failrec))
|
||||||
return PTR_ERR(failrec);
|
return PTR_ERR(failrec);
|
||||||
|
|
||||||
|
|
@ -830,7 +830,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
btrfs_debug(fs_info,
|
btrfs_debug(fs_info,
|
||||||
"failed to repair num_copies %d this_mirror %d failed_mirror %d",
|
"failed to repair num_copies %d this_mirror %d failed_mirror %d",
|
||||||
failrec->num_copies, failrec->this_mirror, failrec->failed_mirror);
|
failrec->num_copies, failrec->this_mirror, failrec->failed_mirror);
|
||||||
free_io_failure(BTRFS_I(inode), failrec);
|
free_io_failure(inode, failrec);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -851,7 +851,7 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
bio_add_page(repair_bio, page, failrec->len, pgoff);
|
bio_add_page(repair_bio, page, failrec->len, pgoff);
|
||||||
repair_bbio->iter = repair_bio->bi_iter;
|
repair_bbio->iter = repair_bio->bi_iter;
|
||||||
|
|
||||||
btrfs_debug(btrfs_sb(inode->i_sb),
|
btrfs_debug(fs_info,
|
||||||
"repair read error: submitting new read to mirror %d",
|
"repair read error: submitting new read to mirror %d",
|
||||||
failrec->this_mirror);
|
failrec->this_mirror);
|
||||||
|
|
||||||
|
|
@ -861,11 +861,10 @@ int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
* error here.
|
* error here.
|
||||||
*/
|
*/
|
||||||
if (submit_buffered)
|
if (submit_buffered)
|
||||||
btrfs_submit_data_read_bio(BTRFS_I(inode), repair_bio,
|
btrfs_submit_data_read_bio(inode, repair_bio,
|
||||||
failrec->this_mirror, 0);
|
failrec->this_mirror, 0);
|
||||||
else
|
else
|
||||||
btrfs_submit_dio_repair_bio(BTRFS_I(inode), repair_bio,
|
btrfs_submit_dio_repair_bio(inode, repair_bio, failrec->this_mirror);
|
||||||
failrec->this_mirror);
|
|
||||||
|
|
||||||
return BLK_STS_OK;
|
return BLK_STS_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -955,7 +954,7 @@ static void submit_data_read_repair(struct inode *inode,
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = btrfs_repair_one_sector(inode, failed_bbio,
|
ret = btrfs_repair_one_sector(BTRFS_I(inode), failed_bbio,
|
||||||
bio_offset + offset, page, pgoff + offset,
|
bio_offset + offset, page, pgoff + offset,
|
||||||
true);
|
true);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ struct io_failure_record {
|
||||||
int num_copies;
|
int num_copies;
|
||||||
};
|
};
|
||||||
|
|
||||||
int btrfs_repair_one_sector(struct inode *inode, struct btrfs_bio *failed_bbio,
|
int btrfs_repair_one_sector(struct btrfs_inode *inode, struct btrfs_bio *failed_bbio,
|
||||||
u32 bio_offset, struct page *page, unsigned int pgoff,
|
u32 bio_offset, struct page *page, unsigned int pgoff,
|
||||||
bool submit_buffered);
|
bool submit_buffered);
|
||||||
void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start, u64 end);
|
void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start, u64 end);
|
||||||
|
|
|
||||||
|
|
@ -7953,7 +7953,7 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
|
||||||
} else {
|
} else {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = btrfs_repair_one_sector(inode, bbio, offset,
|
ret = btrfs_repair_one_sector(BTRFS_I(inode), bbio, offset,
|
||||||
bv.bv_page, bv.bv_offset, false);
|
bv.bv_page, bv.bv_offset, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
err = errno_to_blk_status(ret);
|
err = errno_to_blk_status(ret);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue