Skip to content

Commit 1c76fb7

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: raid56: wait for I/O completion in submit_read_bios
In addition to setting up the end_io handler and submitting the bios in submit_read_bios, also wait for them to be completed instead of waiting for the completion manually in all three callers. Rename submit_read_bios to submit_read_wait_bio_list to make it clear it waits for the bios as well. 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 4d76270 commit 1c76fb7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

fs/btrfs/raid56.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ static void raid_wait_read_end_io(struct bio *bio)
14971497
wake_up(&rbio->io_wait);
14981498
}
14991499

1500-
static void submit_read_bios(struct btrfs_raid_bio *rbio,
1500+
static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
15011501
struct bio_list *bio_list)
15021502
{
15031503
struct bio *bio;
@@ -1514,6 +1514,8 @@ static void submit_read_bios(struct btrfs_raid_bio *rbio,
15141514
}
15151515
submit_bio(bio);
15161516
}
1517+
1518+
wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
15171519
}
15181520

15191521
static int rmw_assemble_read_bios(struct btrfs_raid_bio *rbio,
@@ -2016,8 +2018,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
20162018
if (ret < 0)
20172019
goto out;
20182020

2019-
submit_read_bios(rbio, &bio_list);
2020-
wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
2021+
submit_read_wait_bio_list(rbio, &bio_list);
20212022

20222023
ret = recover_sectors(rbio);
20232024

@@ -2213,8 +2214,7 @@ static int rmw_read_wait_recover(struct btrfs_raid_bio *rbio)
22132214
if (ret < 0)
22142215
goto out;
22152216

2216-
submit_read_bios(rbio, &bio_list);
2217-
wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
2217+
submit_read_wait_bio_list(rbio, &bio_list);
22182218

22192219
/*
22202220
* We may or may not have any corrupted sectors (including missing dev
@@ -2792,8 +2792,7 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
27922792
if (ret < 0)
27932793
goto cleanup;
27942794

2795-
submit_read_bios(rbio, &bio_list);
2796-
wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
2795+
submit_read_wait_bio_list(rbio, &bio_list);
27972796

27982797
/* We may have some failures, recover the failed sectors first. */
27992798
ret = recover_scrub_rbio(rbio);

0 commit comments

Comments
 (0)