|
|
2c1b57 |
From 64ec81da7a70adcdc0dbccaacc69aaf90edb4011 Mon Sep 17 00:00:00 2001
|
|
|
2c1b57 |
From: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
Date: Fri, 5 May 2017 11:51:43 -0400
|
|
|
2c1b57 |
Subject: [RHEL7.5 PATCH 113/169] sysfs/sysfs_read: Count active_disks and
|
|
|
2c1b57 |
failed_disks
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Cound active_disks as drives mark 'in_sync' and failed_disks as
|
|
|
2c1b57 |
disks marked 'faulty', in the same way ioctl(GET_ARRAY_INFO) does.
|
|
|
2c1b57 |
|
|
|
2c1b57 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
2c1b57 |
---
|
|
|
2c1b57 |
sysfs.c | 10 ++++++++--
|
|
|
2c1b57 |
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
2c1b57 |
|
|
|
2c1b57 |
diff --git a/sysfs.c b/sysfs.c
|
|
|
2c1b57 |
index aa30de5..f7967e8 100644
|
|
|
2c1b57 |
--- a/sysfs.c
|
|
|
2c1b57 |
+++ b/sysfs.c
|
|
|
2c1b57 |
@@ -270,6 +270,8 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options)
|
|
|
2c1b57 |
if (!dir)
|
|
|
2c1b57 |
goto abort;
|
|
|
2c1b57 |
sra->array.spare_disks = 0;
|
|
|
2c1b57 |
+ sra->array.active_disks = 0;
|
|
|
2c1b57 |
+ sra->array.failed_disks = 0;
|
|
|
2c1b57 |
|
|
|
2c1b57 |
devp = &sra->devs;
|
|
|
2c1b57 |
sra->devs = NULL;
|
|
|
2c1b57 |
@@ -356,10 +358,14 @@ 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 |
+ if (strstr(buf, "in_sync")) {
|
|
|
2c1b57 |
dev->disk.state |= (1<
|
|
|
2c1b57 |
- if (strstr(buf, "faulty"))
|
|
|
2c1b57 |
+ sra->array.active_disks++;
|
|
|
2c1b57 |
+ }
|
|
|
2c1b57 |
+ if (strstr(buf, "faulty")) {
|
|
|
2c1b57 |
dev->disk.state |= (1<
|
|
|
2c1b57 |
+ sra->array.failed_disks++;
|
|
|
2c1b57 |
+ }
|
|
|
2c1b57 |
if (dev->disk.state == 0)
|
|
|
2c1b57 |
sra->array.spare_disks++;
|
|
|
2c1b57 |
}
|
|
|
2c1b57 |
--
|
|
|
2c1b57 |
2.7.4
|
|
|
2c1b57 |
|