|
|
c3a0e9 |
From 249da94563dddb852ccb52164411ff99a6c90489 Mon Sep 17 00:00:00 2001
|
|
|
c3a0e9 |
From: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c3a0e9 |
Date: Wed, 21 Sep 2022 14:43:51 -0600
|
|
|
c3a0e9 |
Subject: [PATCH 63/63] Create: remove safe_mode_delay local variable
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
All .getinfo_super() call sets the info.safe_mode_delay variables
|
|
|
c3a0e9 |
to a constant value, so no matter what the current state is
|
|
|
c3a0e9 |
that function will always set it to the same value.
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
Create() calls .getinfo_super() multiple times while creating the array.
|
|
|
c3a0e9 |
The value is stored in a local variable for every disk in the loop
|
|
|
c3a0e9 |
to add disks (so the last disc call takes precedence). The local
|
|
|
c3a0e9 |
variable is then used in the call to sysfs_set_safemode().
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
This can be simplified by using info.safe_mode_delay directly. The info
|
|
|
c3a0e9 |
variable had .getinfo_super() called on it early in the function so, by the
|
|
|
c3a0e9 |
reasoning above, it will have the same value as the local variable which
|
|
|
c3a0e9 |
can thus be removed.
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
Doing this allows for factoring out code from Create() in a subsequent
|
|
|
c3a0e9 |
patch.
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
|
|
|
c3a0e9 |
---
|
|
|
c3a0e9 |
Create.c | 4 +---
|
|
|
c3a0e9 |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
diff --git a/Create.c b/Create.c
|
|
|
c3a0e9 |
index 2e8203ec..8ded81dc 100644
|
|
|
c3a0e9 |
--- a/Create.c
|
|
|
c3a0e9 |
+++ b/Create.c
|
|
|
c3a0e9 |
@@ -137,7 +137,6 @@ int Create(struct supertype *st, char *mddev,
|
|
|
c3a0e9 |
int did_default = 0;
|
|
|
c3a0e9 |
int do_default_layout = 0;
|
|
|
c3a0e9 |
int do_default_chunk = 0;
|
|
|
c3a0e9 |
- unsigned long safe_mode_delay = 0;
|
|
|
c3a0e9 |
char chosen_name[1024];
|
|
|
c3a0e9 |
struct map_ent *map = NULL;
|
|
|
c3a0e9 |
unsigned long long newsize;
|
|
|
c3a0e9 |
@@ -952,7 +951,6 @@ int Create(struct supertype *st, char *mddev,
|
|
|
c3a0e9 |
goto abort_locked;
|
|
|
c3a0e9 |
}
|
|
|
c3a0e9 |
st->ss->getinfo_super(st, inf, NULL);
|
|
|
c3a0e9 |
- safe_mode_delay = inf->safe_mode_delay;
|
|
|
c3a0e9 |
|
|
|
c3a0e9 |
if (have_container && c->verbose > 0)
|
|
|
c3a0e9 |
pr_err("Using %s for device %d\n",
|
|
|
c3a0e9 |
@@ -1065,7 +1063,7 @@ int Create(struct supertype *st, char *mddev,
|
|
|
c3a0e9 |
"readonly");
|
|
|
c3a0e9 |
break;
|
|
|
c3a0e9 |
}
|
|
|
c3a0e9 |
- sysfs_set_safemode(&info, safe_mode_delay);
|
|
|
c3a0e9 |
+ sysfs_set_safemode(&info, info.safe_mode_delay);
|
|
|
c3a0e9 |
if (err) {
|
|
|
c3a0e9 |
pr_err("failed to activate array.\n");
|
|
|
c3a0e9 |
ioctl(mdfd, STOP_ARRAY, NULL);
|
|
|
c3a0e9 |
--
|
|
|
c3a0e9 |
2.38.1
|
|
|
c3a0e9 |
|