Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
mdadm.12486
0116-sysfs-sysfs_read-Count-active_disks-and-fa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0116-sysfs-sysfs_read-Count-active_disks-and-failed_disks.patch of Package mdadm.12486
From 64ec81da7a70adcdc0dbccaacc69aaf90edb4011 Mon Sep 17 00:00:00 2001 From: Jes Sorensen <jsorensen@fb.com> Date: Fri, 5 May 2017 11:51:43 -0400 Subject: [PATCH] sysfs/sysfs_read: Count active_disks and failed_disks Git-commit: 64ec81da7a70adcdc0dbccaacc69aaf90edb4011 Patch-mainline: mdadm-4.0+ References: bsc#1069165, bsc#1069167, bsc#1068030 Cound active_disks as drives mark 'in_sync' and failed_disks as disks marked 'faulty', in the same way ioctl(GET_ARRAY_INFO) does. Signed-off-by: Jes Sorensen <jsorensen@fb.com> Signed-off-by: Coly Li <colyli@suse.de> --- sysfs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sysfs.c b/sysfs.c index aa30de5..f7967e8 100644 --- a/sysfs.c +++ b/sysfs.c @@ -270,6 +270,8 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) if (!dir) goto abort; sra->array.spare_disks = 0; + sra->array.active_disks = 0; + sra->array.failed_disks = 0; devp = &sra->devs; sra->devs = NULL; @@ -356,10 +358,14 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) strcpy(dbase, "state"); if (load_sys(fname, buf, sizeof(buf))) goto abort; - if (strstr(buf, "in_sync")) + if (strstr(buf, "in_sync")) { dev->disk.state |= (1<<MD_DISK_SYNC); - if (strstr(buf, "faulty")) + sra->array.active_disks++; + } + if (strstr(buf, "faulty")) { dev->disk.state |= (1<<MD_DISK_FAULTY); + sra->array.failed_disks++; + } if (dev->disk.state == 0) sra->array.spare_disks++; } -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor