summaryrefslogtreecommitdiff
path: root/fs/btrfs/raid56.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-01-11 07:23:27 +0100
committerDavid Sterba <dsterba@suse.com>2023-02-15 19:38:54 +0100
commit1c76fb7b31a43ad8b63faa3c6612b04eb3dea5d6 (patch)
treea1c01d3c69cefe64ca0fa599d36d29d05d1bf246 /fs/btrfs/raid56.c
parent4d7627010bc24f68d617c1c455e12a3dfcffcb2c (diff)
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 <wqu@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid56.c')
-rw-r--r--fs/btrfs/raid56.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 037dae1b7313..6c63f6428117 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1497,7 +1497,7 @@ static void raid_wait_read_end_io(struct bio *bio)
wake_up(&rbio->io_wait);
}
-static void submit_read_bios(struct btrfs_raid_bio *rbio,
+static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
struct bio_list *bio_list)
{
struct bio *bio;
@@ -1514,6 +1514,8 @@ static void submit_read_bios(struct btrfs_raid_bio *rbio,
}
submit_bio(bio);
}
+
+ wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
}
static int rmw_assemble_read_bios(struct btrfs_raid_bio *rbio,
@@ -2016,8 +2018,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
if (ret < 0)
goto out;
- submit_read_bios(rbio, &bio_list);
- wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
+ submit_read_wait_bio_list(rbio, &bio_list);
ret = recover_sectors(rbio);
@@ -2213,8 +2214,7 @@ static int rmw_read_wait_recover(struct btrfs_raid_bio *rbio)
if (ret < 0)
goto out;
- submit_read_bios(rbio, &bio_list);
- wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
+ submit_read_wait_bio_list(rbio, &bio_list);
/*
* 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)
if (ret < 0)
goto cleanup;
- submit_read_bios(rbio, &bio_list);
- wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
+ submit_read_wait_bio_list(rbio, &bio_list);
/* We may have some failures, recover the failed sectors first. */
ret = recover_scrub_rbio(rbio);