From: Li Nan <linan122@xxxxxxxxxx> Getting rdev/replacement from mirror is risky. Replacement can replace rdev while repl_bio pending, which forces us to add some complex code to handle this scenario, but there are still some bugs left. Record rdev/replacement in r10bio and get them from r10bio is a better way. It is easy to ensure that rdev and replacement remains consistent in io process, which can help us clean up some code and fix bugs. Signed-off-by: Li Nan <linan122@xxxxxxxxxx> --- drivers/md/raid10.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index 8c072ce0bc54..261315ffe8c0 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h @@ -145,12 +145,12 @@ struct r10bio { */ struct r10dev { struct bio *bio; - union { - struct bio *repl_bio; /* used for resync and - * writes */ - struct md_rdev *rdev; /* used for reads - * (read_slot >= 0) */ - }; + /* Currently just used for normal reads and writes */ + struct md_rdev *rdev; + /* used for resync and writes */ + struct bio *repl_bio; + /* Currently just used for normal writes */ + struct md_rdev *replacement; sector_t addr; int devnum; } devs[]; -- 2.39.2