|
|
2c1b57 |
From 8b0ebd645202b627982eb3ed9fc72583c4f245d3 Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
Date: Tue, 9 May 2017 17:09:40 -0400
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 133/169] sysfs/sysfs_read: Count working_disks
|
|
|
2c1b57 |
|
|
|
2c1b57 |
This counts working_disks the same way as get_array_info counts it in
|
|
|
2c1b57 |
the kernel.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
sysfs.c | 15 +++++++++------
|
|
|
2c1b57 |
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/sysfs.c b/sysfs.c
|
|
|
2c1b57 |
index f7967e8..e47f5e4 100644
|
|
|
2c1b57 |
--- a/sysfs.c
|
|
|
2c1b57 |
+++ b/sysfs.c
|
|
|
2c1b57 |
@@ -272,6 +272,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
|
2c1b57 |
sra->array.spare_disks = 0;
|
|
|
2c1b57 |
sra->array.active_disks = 0;
|
|
|
2c1b57 |
sra->array.failed_disks = 0;
|
|
|
2c1b57 |
+ sra->array.working_disks = 0;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
devp = &sra->devs;
|
|
|
2c1b57 |
sra->devs = NULL;
|
|
|
2c1b57 |
@@ -358,16 +359,18 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
|
2c1b57 |
strcpy(dbase, "state");
|
|
|
2c1b57 |
if (load_sys(fname, buf, sizeof(buf)))
|
|
|
2c1b57 |
goto abort;
|
|
|
2c1b57 |
- if (strstr(buf, "in_sync")) {
|
|
|
2c1b57 |
- dev->disk.state |= (1<
|
|
|
2c1b57 |
- sra->array.active_disks++;
|
|
|
2c1b57 |
- }
|
|
|
2c1b57 |
if (strstr(buf, "faulty")) {
|
|
|
2c1b57 |
dev->disk.state |= (1<
|
|
|
2c1b57 |
sra->array.failed_disks++;
|
|
|
2c1b57 |
+ } else {
|
|
|
2c1b57 |
+ sra->array.working_disks++;
|
|
|
2c1b57 |
+ if (strstr(buf, "in_sync")) {
|
|
|
2c1b57 |
+ dev->disk.state |= (1<
|
|
|
2c1b57 |
+ sra->array.active_disks++;
|
|
|
2c1b57 |
+ }
|
|
|
2c1b57 |
+ if (dev->disk.state == 0)
|
|
|
2c1b57 |
+ sra->array.spare_disks++;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
- if (dev->disk.state == 0)
|
|
|
2c1b57 |
- sra->array.spare_disks++;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
if (options & GET_ERROR) {
|
|
|
2c1b57 |
strcpy(buf, "errors");
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|