diff options
author | Qu Wenruo <wqu@suse.com> | 2022-11-01 19:16:05 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-12-05 18:00:49 +0100 |
commit | d817ce35d24a53c6736ac68e759ed83135ff7c3b (patch) | |
tree | 3e8a1135f7b61452e68324487fecb6cf7094629e /fs/btrfs/raid56.h | |
parent | ec936b0354e2d716e977e16165d188db044696b7 (diff) |
btrfs: raid56: switch recovery path to a single function
Currently btrfs uses end_io functions to jump between different stages
of recovery.
For example, we go the following different functions:
- raid56_bio_end_io()
This handles the read for all the sectors (except the missing device).
- __raid_recover_end_io()
This does the real work, it's called inside the delayed work function
raid_recover_end_io_work().
This one recovery path involves at least 3 different functions, which is
a big burden for readers.
This patch will change the behavior by:
- Introduce a unified recovery entrance, recover_rbio()
- Use submit-and-wait method
So the workflow is not interrupted by the endio function jump.
This doesn't bring performance change, but reduce the burden for
reviewers.
- Run the main function in the rmw_workers workqueue
Now raid56_parity_recover() only needs to setup the work, and
queue the work using start_async_work().
Now readers only need to do one function jump (start_async_work()) to
find out the main entrance of recovery path.
Furthermore, recover_rbio() function can easily be reused by other paths.
The old recovery path is still utilized by degraded write path.
It will be cleaned up when we have migrated the write path.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/raid56.h')
-rw-r--r-- | fs/btrfs/raid56.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/raid56.h b/fs/btrfs/raid56.h index 91d5c0adad15..445e833fcfcf 100644 --- a/fs/btrfs/raid56.h +++ b/fs/btrfs/raid56.h @@ -95,6 +95,8 @@ struct btrfs_raid_bio { atomic_t error; + wait_queue_head_t io_wait; + struct work_struct end_io_work; /* Bitmap to record which horizontal stripe has data */ |