Thread (7 messages) 7 messages, 3 authors, 2023-06-16
STALE1119d

[PATCH 1/3] md/raid10: record rdev/replacement in struct r10bio

From: <hidden>
Date: 2023-06-14 08:52:49
Also in: lkml
Subsystem: software raid (multiple disks) support, the rest · Maintainers: Song Liu, Yu Kuai, Linus Torvalds

From: Li Nan <redacted>

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help