Thread (19 messages) 19 messages, 4 authors, 2022-09-19

Re: [PATCH v3 5/5] md/raid10: convert resync_lock to use seqlock

From: Guoqing Jiang <hidden>
Date: 2022-09-18 11:36:43
Also in: lkml


On 9/16/22 7:34 PM, Yu Kuai wrote:
quoted hunk ↗ jump to hunk
From: Yu Kuai <redacted>

Currently, wait_barrier() will hold 'resync_lock' to read 'conf->barrier',
and io can't be dispatched until 'barrier' is dropped.

Since holding the 'barrier' is not common, convert 'resync_lock' to use
seqlock so that holding lock can be avoided in fast path.

Signed-off-by: Yu Kuai <redacted>
---
  drivers/md/raid10.c | 87 ++++++++++++++++++++++++++++++---------------
  drivers/md/raid10.h |  2 +-
  2 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 9a28abd19709..2daa7d57034c 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -79,6 +79,21 @@ static void end_reshape(struct r10conf *conf);
  
  #include "raid1-10.c"
  
+#define NULL_CMD
+#define cmd_before(conf, cmd) \
+	do { \
+		write_sequnlock_irq(&(conf)->resync_lock); \
+		cmd; \
+	} while (0)
+#define cmd_after(conf) write_seqlock_irq(&(conf)->resync_lock)
The two is not paired well given only cmd_before needs the 'cmd'.
+
+#define wait_event_barrier_cmd(conf, cond, cmd) \
+	wait_event_cmd((conf)->wait_barrier, cond, cmd_before(conf, cmd), \
+		       cmd_after(conf))
+
+#define wait_event_barrier(conf, cond) \
+	wait_event_barrier_cmd(conf, cond, NULL_CMD)
What is the issue without define NULL_CMD?

Thanks,
Guoqing
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help