Thread (20 messages) 20 messages, 4 authors, 2023-08-20

Re: [PATCH -next v2 2/7] md: factor out a helper to choose sync direction from md_check_recovery()

From: Yu Kuai <hidden>
Date: 2023-08-20 02:43:59
Also in: lkml

Hi,

在 2023/08/18 5:49, Song Liu 写道:
On Thu, Aug 17, 2023 at 12:58 AM Mariusz Tkaczyk
[off-list ref] wrote:
quoted
On Tue, 15 Aug 2023 11:09:52 +0800
Yu Kuai [off-list ref] wrote:
quoted
From: Yu Kuai <redacted>

There are no functional changes, on the one hand make the code cleaner,
on the other hand prevent following checkpatch error in the next patch to
delay choosing sync direction to md_start_sync().

ERROR: do not use assignment in if condition
+       } else if ((spares = remove_and_add_spares(mddev, NULL))) {

Signed-off-by: Yu Kuai <redacted>
---
  drivers/md/md.c | 68 +++++++++++++++++++++++++++++++------------------
  1 file changed, 43 insertions(+), 25 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 90815be1e80f..4846ff6d25b0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9246,6 +9246,48 @@ static int remove_and_add_spares(struct mddev *mddev,
       return spares;
  }

+static bool md_choose_sync_direction(struct mddev *mddev, int *spares)
The naming is little confusing because as a direction I would expect forward or
backward - from end to start or or from start to end. In this case you are
determining the type of the background operation needed. Assuming that reshape
is a kind of "sync" operation I would say "md_choose_sync_action".
Yeah, md_choose_sync_direction is indeed confusing.
Thanks for the suggestion, I'll update this in the new version.

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