Commit 40f87ddb authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: raid56: handle endio in recover_rbio

Both callers of recover_rbio call rbio_orig_end_io right after it, so
move the call into the shared function.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1d0ef1ca
...@@ -1914,7 +1914,7 @@ static int recover_sectors(struct btrfs_raid_bio *rbio) ...@@ -1914,7 +1914,7 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
return ret; return ret;
} }
static int recover_rbio(struct btrfs_raid_bio *rbio) static void recover_rbio(struct btrfs_raid_bio *rbio)
{ {
struct bio_list bio_list = BIO_EMPTY_LIST; struct bio_list bio_list = BIO_EMPTY_LIST;
int total_sector_nr; int total_sector_nr;
...@@ -1929,7 +1929,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio) ...@@ -1929,7 +1929,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
/* For recovery, we need to read all sectors including P/Q. */ /* For recovery, we need to read all sectors including P/Q. */
ret = alloc_rbio_pages(rbio); ret = alloc_rbio_pages(rbio);
if (ret < 0) if (ret < 0)
return ret; goto out;
index_rbio_pages(rbio); index_rbio_pages(rbio);
...@@ -1967,37 +1967,28 @@ static int recover_rbio(struct btrfs_raid_bio *rbio) ...@@ -1967,37 +1967,28 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
sectornr, REQ_OP_READ); sectornr, REQ_OP_READ);
if (ret < 0) { if (ret < 0) {
bio_list_put(&bio_list); bio_list_put(&bio_list);
return ret; goto out;
} }
} }
submit_read_wait_bio_list(rbio, &bio_list); submit_read_wait_bio_list(rbio, &bio_list);
return recover_sectors(rbio); ret = recover_sectors(rbio);
out:
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
} }
static void recover_rbio_work(struct work_struct *work) static void recover_rbio_work(struct work_struct *work)
{ {
struct btrfs_raid_bio *rbio; struct btrfs_raid_bio *rbio;
int ret;
rbio = container_of(work, struct btrfs_raid_bio, work); rbio = container_of(work, struct btrfs_raid_bio, work);
if (!lock_stripe_add(rbio))
ret = lock_stripe_add(rbio); recover_rbio(rbio);
if (ret == 0) {
ret = recover_rbio(rbio);
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
}
} }
static void recover_rbio_work_locked(struct work_struct *work) static void recover_rbio_work_locked(struct work_struct *work)
{ {
struct btrfs_raid_bio *rbio; recover_rbio(container_of(work, struct btrfs_raid_bio, work));
int ret;
rbio = container_of(work, struct btrfs_raid_bio, work);
ret = recover_rbio(rbio);
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
} }
static void set_rbio_raid6_extra_error(struct btrfs_raid_bio *rbio, int mirror_num) static void set_rbio_raid6_extra_error(struct btrfs_raid_bio *rbio, int mirror_num)
......
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