Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
mdadm.7989
0133-sysfs-sysfs_read-Count-working_disks.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0133-sysfs-sysfs_read-Count-working_disks.patch of Package mdadm.7989
From 8b0ebd645202b627982eb3ed9fc72583c4f245d3 Mon Sep 17 00:00:00 2001 From: Jes Sorensen <jsorensen@fb.com> Date: Tue, 9 May 2017 17:09:40 -0400 Subject: [PATCH] sysfs/sysfs_read: Count working_disks Git-commit: 8b0ebd645202b627982eb3ed9fc72583c4f245d3 Patch-mainline: mdadm-4.0+ References: bsc#1069165, bsc#1069167, bsc#1068030 This counts working_disks the same way as get_array_info counts it in the kernel. Signed-off-by: Jes Sorensen <jsorensen@fb.com> Signed-off-by: Coly Li <colyli@suse.de> --- sysfs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sysfs.c b/sysfs.c index f7967e8..e47f5e4 100644 --- a/sysfs.c +++ b/sysfs.c @@ -272,6 +272,7 @@ struct mdinfo *sysfs_read(int fd, char *devnm, unsigned long options) sra->array.spare_disks = 0; sra->array.active_disks = 0; sra->array.failed_disks = 0; + sra->array.working_disks = 0; devp = &sra->devs; sra->devs = NULL; @@ -358,16 +359,18 @@ 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")) { - dev->disk.state |= (1<<MD_DISK_SYNC); - sra->array.active_disks++; - } if (strstr(buf, "faulty")) { dev->disk.state |= (1<<MD_DISK_FAULTY); sra->array.failed_disks++; + } else { + sra->array.working_disks++; + if (strstr(buf, "in_sync")) { + dev->disk.state |= (1<<MD_DISK_SYNC); + sra->array.active_disks++; + } + if (dev->disk.state == 0) + sra->array.spare_disks++; } - if (dev->disk.state == 0) - sra->array.spare_disks++; } if (options & GET_ERROR) { strcpy(buf, "errors"); -- 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