Skip to content

Commit 40f87dd

Browse files
Christoph Hellwigkdave
authored andcommitted
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: Qu Wenruo <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1d0ef1c commit 40f87dd

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

fs/btrfs/raid56.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,7 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
19141914
return ret;
19151915
}
19161916

1917-
static int recover_rbio(struct btrfs_raid_bio *rbio)
1917+
static void recover_rbio(struct btrfs_raid_bio *rbio)
19181918
{
19191919
struct bio_list bio_list = BIO_EMPTY_LIST;
19201920
int total_sector_nr;
@@ -1929,7 +1929,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
19291929
/* For recovery, we need to read all sectors including P/Q. */
19301930
ret = alloc_rbio_pages(rbio);
19311931
if (ret < 0)
1932-
return ret;
1932+
goto out;
19331933

19341934
index_rbio_pages(rbio);
19351935

@@ -1967,37 +1967,28 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
19671967
sectornr, REQ_OP_READ);
19681968
if (ret < 0) {
19691969
bio_list_put(&bio_list);
1970-
return ret;
1970+
goto out;
19711971
}
19721972
}
19731973

19741974
submit_read_wait_bio_list(rbio, &bio_list);
1975-
return recover_sectors(rbio);
1975+
ret = recover_sectors(rbio);
1976+
out:
1977+
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
19761978
}
19771979

19781980
static void recover_rbio_work(struct work_struct *work)
19791981
{
19801982
struct btrfs_raid_bio *rbio;
1981-
int ret;
19821983

19831984
rbio = container_of(work, struct btrfs_raid_bio, work);
1984-
1985-
ret = lock_stripe_add(rbio);
1986-
if (ret == 0) {
1987-
ret = recover_rbio(rbio);
1988-
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
1989-
}
1985+
if (!lock_stripe_add(rbio))
1986+
recover_rbio(rbio);
19901987
}
19911988

19921989
static void recover_rbio_work_locked(struct work_struct *work)
19931990
{
1994-
struct btrfs_raid_bio *rbio;
1995-
int ret;
1996-
1997-
rbio = container_of(work, struct btrfs_raid_bio, work);
1998-
1999-
ret = recover_rbio(rbio);
2000-
rbio_orig_end_io(rbio, errno_to_blk_status(ret));
1991+
recover_rbio(container_of(work, struct btrfs_raid_bio, work));
20011992
}
20021993

20031994
static void set_rbio_raid6_extra_error(struct btrfs_raid_bio *rbio, int mirror_num)

0 commit comments

Comments
 (0)