[PATCH 09/17] Monitor: avoid skipping checks on external arays
[PATCH 09/17] Monitor: avoid skipping checks on external arays
am 29.10.2010 16:23:26 von anna.czarnowska
From bb9ca6dbe0a92e00b21cd8985533b561b40ed6b9 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska
Date: Mon, 25 Oct 2010 11:30:43 +0200
Subject: [PATCH 09/17] Monitor: avoid skipping checks on external arays
utime is not correct for external metadata so we can only
skip further checks for native metadata
Signed-off-by: Anna Czarnowska
---
Monitor.c | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/Monitor.c b/Monitor.c
index a4bfedd..d915d7d 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -50,6 +50,7 @@ struct state {
int devstate[MaxDisks];
unsigned devid[MaxDisks];
int percent;
+ char *metadata_version;
struct state *next;
};
@@ -223,6 +224,7 @@ int Monitor(mddev_dev_t devlist,
st->spare_group = strdup(mdlist->spare_group);
else
st->spare_group = NULL;
+ st->metadata_version = NULL;
statelist = st;
}
} else {
@@ -240,6 +242,7 @@ int Monitor(mddev_dev_t devlist,
st->percent = -2;
st->expected_spares = -1;
st->spare_group = NULL;
+ st->metadata_version = NULL;
if (mdlist) {
st->expected_spares = mdlist->spare_disks;
if (mdlist->spare_group)
@@ -328,17 +331,22 @@ int Monitor(mddev_dev_t devlist,
/* external arrays don't update utime */
array.utime = time(0);
- if (st->utime == array.utime &&
- st->failed == array.failed_disks &&
- st->working == array.working_disks &&
- st->spare == array.spare_disks &&
- (mse == NULL || (
- mse->percent == st->percent
- ))) {
+ /* utime cannot be trusted for external
+ * metadata, so treat utime for external
+ * metadata as different
+ */
+ if (st->utime == array.utime &&
+ st->metadata_version &&
+ !is_external(st->metadata_version) &&
+ st->failed == array.failed_disks &&
+ st->working == array.working_disks &&
+ st->spare == array.spare_disks &&
+ mse->percent == st->percent) {
close(fd);
st->err = 0;
continue;
}
+
if (st->utime == 0 && /* new array */
mse->pattern && strchr(mse->pattern, '_') /* degraded */
)
@@ -454,6 +462,16 @@ int Monitor(mddev_dev_t devlist,
st->utime = array.utime;
st->raid = array.raid_disks;
st->err = 0;
+ if (mse->metadata_version) {
+ if (!st->metadata_version)
+ st->metadata_version = strdup(mse->metadata_version);
+ else if (strcmp(st->metadata_version,
+ mse->metadata_version) != 0) {
+ free(st->metadata_version);
+ st->metadata_version = strdup(mse->metadata_version);
+ }
+ }
+
}
/* now check if there are any new devices found in mdstat */
if (scan) {
@@ -486,6 +504,7 @@ int Monitor(mddev_dev_t devlist,
st->devnum = mse->devnum;
st->percent = -2;
st->spare_group = NULL;
+ st->metadata_version = NULL;
st->expected_spares = -1;
statelist = st;
if (test)
--
1.6.4.2
------------------------------------------------------------ ---------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk
Sad Rejonowy Gdansk Polnoc w Gdansku,
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego,
numer KRS 101882
NIP 957-07-52-316
Kapital zakladowy 200.000 zl
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/17] Monitor: avoid skipping checks on external arays
am 05.11.2010 06:47:11 von dan.j.williams
On 10/29/2010 7:23 AM, Czarnowska, Anna wrote:
> From bb9ca6dbe0a92e00b21cd8985533b561b40ed6b9 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska
> Date: Mon, 25 Oct 2010 11:30:43 +0200
> Subject: [PATCH 09/17] Monitor: avoid skipping checks on external arays
>
> utime is not correct for external metadata so we can only
> skip further checks for native metadata
>
> Signed-off-by: Anna Czarnowska
> ---
> Monitor.c | 33 ++++++++++++++++++++++++++-------
> 1 files changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/Monitor.c b/Monitor.c
> index a4bfedd..d915d7d 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -50,6 +50,7 @@ struct state {
> int devstate[MaxDisks];
> unsigned devid[MaxDisks];
> int percent;
> + char *metadata_version;
Another small nit... this is really just a "int utime_valid" flag,
calling it "char *metadata_version" is a slightly confusing shortcut.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 09/17] Monitor: avoid skipping checks on external arays
am 05.11.2010 15:56:11 von anna.czarnowska
Metadata_version is needed for:
Deciding if metadata type is container-based - more than just the utime check depends on it
Getting parent container number from subarrays - for linking subarrays with containers
Obtaining superswitch - to avoid calling guess_super when we already know the kind of metadata
Introducing utime_valid flag would just duplicate part of information included in metadata_version.
Regards
Anna
-----Original Message-----
From: Williams, Dan J
Sent: Friday, November 05, 2010 6:47 AM
To: Czarnowska, Anna
Cc: Neil Brown; linux-raid@vger.kernel.org; Neubauer, Wojciech; Ciechanowski, Ed; Labun, Marcin; Hawrylewicz Czarnowski, Przemyslaw
Subject: Re: [PATCH 09/17] Monitor: avoid skipping checks on external arays
On 10/29/2010 7:23 AM, Czarnowska, Anna wrote:
> From bb9ca6dbe0a92e00b21cd8985533b561b40ed6b9 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska
> Date: Mon, 25 Oct 2010 11:30:43 +0200
> Subject: [PATCH 09/17] Monitor: avoid skipping checks on external arays
>
> utime is not correct for external metadata so we can only
> skip further checks for native metadata
>
> Signed-off-by: Anna Czarnowska
> ---
> Monitor.c | 33 ++++++++++++++++++++++++++-------
> 1 files changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/Monitor.c b/Monitor.c
> index a4bfedd..d915d7d 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -50,6 +50,7 @@ struct state {
> int devstate[MaxDisks];
> unsigned devid[MaxDisks];
> int percent;
> + char *metadata_version;
Another small nit... this is really just a "int utime_valid" flag,
calling it "char *metadata_version" is a slightly confusing shortcut.
------------------------------------------------------------ ---------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk
Sad Rejonowy Gdansk Polnoc w Gdansku,
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego,
numer KRS 101882
NIP 957-07-52-316
Kapital zakladowy 200.000 zl
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/17] Monitor: avoid skipping checks on external arays
am 05.11.2010 17:17:17 von dan.j.williams
On 11/05/2010 07:56 AM, Czarnowska, Anna wrote:
> Metadata_version is needed for:
> Deciding if metadata type is container-based - more than just the utime check depends on it
> Getting parent container number from subarrays - for linking subarrays with containers
> Obtaining superswitch - to avoid calling guess_super when we already know the kind of metadata
>
> Introducing utime_valid flag would just duplicate part of information included in metadata_version.
> Regards
> Anna
Ah, ok reading this patch in isolation does not convey these future
usages. We could put this text in the changelog.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html