forked from pool/mdadm
849a39cd07
- Update mdadm for SLE15, for bug fixes and new feature enhancement - 1000-The-mdcheck-script-now-adds-messages-to-the-system.patch is removed because upstream has similar fix with almost identical funcationality. - The following patches are not deleted indeed, they are renamed and added into all other new-added patches with different perfix numbers, 0038-Create-Fixup-bad-placement-of-logical-in-multi-line-.patch 0039-Create-Fixup-various-whitespace-issues.patch 0040-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch 0041-mdopen-use-parameters-new_array-to-create-arrays-whe.patch 0042-mdadm-manpage-update-manpage-for-readonly-parameter.patch 0043-mdadm-manpage-clustered-arrays-don-t-support-array-s.patch 0044-maps-Terminate-modes-map-correctly.patch 0045-Grow_continue_command-ensure-content-is-properly-ini.patch 0046-systemd-mdadm-last-resort-use-ConditionPathExists-in.patch 0047-Detail-ensure-export-names-are-acceptable-as-shell-v.patch 0048-Grow-set-component-size-prior-to-array-size.patch 0049-Grow-don-t-allow-to-enable-PPL-when-reshape-is-in-pr.patch 0050-Grow-don-t-allow-array-geometry-change-with-ppl-enab.patch 0051-IMSM-Correct-examine-output-for-4k-disks.patch 0052-imsm-allow-drives-in-a-container-regardless-of-secto.patch 0053-imsm-allocate-buffer-to-support-maximum-sector-size.patch 0054-imsm-don-t-allow-disks-with-different-sector-size-in.patch 0055-Allow-more-spare-selection-criteria.patch 0056-Add-sector-size-as-spare-selection-criterion.patch 0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch 0058-super1-only-set-clustered-flag-when-bitmap-is-presen.patch 0059-To-support-clustered-raid10.patch 0060-udev-rules-introduce-rules-for-cluster-md-to-confirm.patch - The following patche set includes the above renamed patches, they have bug fixes for bsc#1068030, bsc#1069165, bsc#1069167, and some other fixes and enhancement for raid5 ppl, imsm, and general mdadm code, 0038-mdadm-Create-declaring-an-existing-struct-within-sam.patch 0039-Create-Fixup-bad-placement-of-logical-in-multi-line-.patch 0040-Create-Fixup-various-whitespace-issues.patch 0041-mdadm.c-fix-compile-warning-mdfd-is-uninitialized.patch 0042-mdopen-use-parameters-new_array-to-create-arrays-whe.patch 0043-mdadm-manpage-update-manpage-for-readonly-parameter.patch 0044-mdadm-manpage-clustered-arrays-don-t-support-array-s.patch 0045-maps-Terminate-modes-map-correctly.patch 0046-Grow_continue_command-ensure-content-is-properly-ini.patch 0047-systemd-mdadm-last-resort-use-ConditionPathExists-in.patch 0048-Detail-ensure-export-names-are-acceptable-as-shell-v.patch 0049-Grow-set-component-size-prior-to-array-size.patch 0050-Grow-don-t-allow-to-enable-PPL-when-reshape-is-in-pr.patch 0051-Grow-don-t-allow-array-geometry-change-with-ppl-enab.patch 0052-IMSM-Correct-examine-output-for-4k-disks.patch 0053-imsm-allow-drives-in-a-container-regardless-of-secto.patch 0054-imsm-allocate-buffer-to-support-maximum-sector-size.patch 0055-imsm-don-t-allow-disks-with-different-sector-size-in.patch 0056-mdadm-mdmon-deleted-the-abort_reshape-never-invoked.patch 0057-util-Introduce-md_get_array_info.patch 0058-Incremental-Remove-redundant-call-for-GET_ARRAY_INFO.patch 0059-util-Introduce-md_get_disk_info.patch 0060-util-Introduce-md_set_array_info.patch 0061-md_u-Remove-some-unused-ioctl-declarations.patch 0062-mdadm-grow-reshape-would-be-stuck-from-raid1-to-raid.patch 0063-sysfs-Use-the-presence-of-sys-block-dev-md-as-indica.patch 0064-sysfs-Make-sysfs_init-return-an-error-code.patch 0065-util-must_be_container-Use-sysfs_read-GET_VERSION-to.patch 0066-util-set_array_info-Simplify-code-since-md_get_versi.patch 0067-Assemble-Assemble-Stop-checking-kernel-md-driver-ver.patch 0068-Build-Stop-bothering-about-supporting-md-driver-olde.patch 0069-Grow-Stop-bothering-about-md-driver-versions-older-t.patch 0070-Detail-Stop-bothering-about-md-drivers-older-than-0..patch 0071-Create-Remove-all-attemps-to-handle-md-driver-older-.patch 0072-Manage-Remove-all-references-to-md_get_version.patch 0073-Query-Remove-all-references-to-md_get_version.patch 0074-bitmap-Remove-use-of-md_get_version.patch 0075-mdmon-Stop-bothering-about-md_get_version.patch 0076-mdopen-open_mddev-Use-md_get_array_info-to-determine.patch 0077-mdassemble-Use-md_get_array_info-to-check-for-valid-.patch 0078-Assemble-Assemble-Get-rid-of-last-use-of-md_get_vers.patch 0079-util-Finally-kill-off-md_get_version.patch 0080-mdadm-Fail-for-kernels-older-than-2.6.15.patch 0081-Revert-mdadm-grow-reshape-would-be-stuck-from-raid1-.patch 0082-Retire-mdassemble.patch 0083-super1-Clean-up-various-style-abuses.patch 0084-Detail-Remove-pre-2.6-code-for-printing-info-on-rebu.patch 0085-Assemble-Remove-obsolete-test-for-kernels-older-than.patch 0086-Detail-Fixup-ugly-if-foo-abuse.patch 0087-Query-Handle-error-returned-by-fstat.patch 0088-Query-Use-sysfs-to-obtain-data-if-possible.patch 0089-sysfs-Parse-array_state-in-sysfs_read.patch 0090-util-Introduce-md_array_active-helper.patch 0091-maps-Use-keyvalue-for-null-terminator-to-indicate-un.patch 0092-util-Get-rid-of-unused-enough_fd.patch 0093-mdadm-retire-mdassemble-in-make-everything.patch 0094-Query-Quiet-gcc-since-it-cannot-know-errno-0-in-this.patch 0095-Makefile-Default-to-O2-optimization.patch 0096-maps-Simplify-implementation-of-map_name.patch 0097-Don-t-use-UnSet-with-consistency_policy.patch 0098-Detail-determine-array-state-from-sysfs.patch 0099-Detail-Respect-code-lines-are-80-character-wide.patch 0100-Detail-Reinstate-support-for-not-having-sysfs.patch 0101-Incremental-Use-md_array_active-where-applicable.patch 0102-Incremental-Cleanup-some-if-statement-spaghetti.patch 0103-Create-tell-udev-md-device-is-not-ready-when-first-c.patch 0104-Incremental-Use-md_array_active-to-determine-state-o.patch 0105-Manage-Manage_ro-Use-md_array_active.patch 0106-IMSM-Initialize-my_vol_raid_dev_num-during-vol-creat.patch 0107-Grow-Grow_continue_command-Avoid-aliasing-array-vari.patch 0108-change-back-0644-permission-for-Grow.c.patch 0109-util-md_array_valid-Introduce-md_array_valid-helper.patch 0110-kernel-patch-Remove-obsolete-kernel-patches-against-.patch 0111-mdassemble-Kill-off-the-last-remains.patch 0112-mdadm-util-unify-fstat-checking-blkdev-into-function.patch 0113-mdadm-util-unify-stat-checking-blkdev-into-function.patch 0114-Fix-typo-in-new-udev-rule.patch 0115-Incremental-return-is-not-a-function.patch 0116-sysfs-sysfs_read-Count-active_disks-and-failed_disks.patch 0117-container_members_max_degradation-Switch-to-using-sy.patch 0118-IncrementalScan-Use-md_array_active-instead-of-md_ge.patch 0119-Mention-endian-in-documentation-for-update-byte-orde.patch 0120-Monitor-Use-md_array_active-instead-of-manually-fidd.patch 0121-Monitor-Code-is-80-characters-per-line.patch 0122-mdadm-md.4-set-page-length-as-1000-to-avoid-warnings.patch 0123-Allow-more-spare-selection-criteria.patch 0124-Add-sector-size-as-spare-selection-criterion.patch 0125-Monitor-check_array-Centralize-exit-path.patch 0126-Monitor-check_array-Reduce-duplicated-error-handling.patch 0127-Monitor-check_array-Declate-mdinfo-instance-globally.patch 0128-Monitor-check_array-Read-sysfs-entry-earlier.patch 0129-Monitor-check_array-Obtain-RAID-level-from-syfs.patch 0130-Monitor-check_array-Get-failed_disks-from-sysfs.patch 0131-Monitor-check_array-Get-array_disks-from-sysfs.patch 0132-Monitor-check_array-Get-nr_disks-active_disks-and-sp.patch 0133-sysfs-sysfs_read-Count-working_disks.patch 0134-Monitor-check_array-Use-working_disks-from-sysfs.patch 0135-retire-the-APIs-that-driver-no-longer-supports.patch 0136-Monitor-Not-much-point-declaring-mdlist-in-both-fork.patch 0137-Monitor-mailfrom-is-initialized-correctly.patch 0138-Monitor-Fixup-a-pile-of-whitespace-issues.patch 0139-mdadm-Uninitialized-variable-rdev.patch 0140-super-ddf-sysfs_read-takes-a-pointer-as-device-name-.patch 0141-mdadm-Fixup-a-large-number-of-bad-formatting-of-logi.patch 0142-mdadm-Fixup-more-broken-logical-operator-formatting.patch 0143-mdadm-Fix-broken-formatting.patch 0144-mdadm-Fixup-broken-formatting.patch 0145-Detail-don-t-exit-if-ioctl-has-been-successful.patch 0146-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch 0147-md_u-Remove-unused-ioctl-declaration-of-START_ARRAY.patch 0148-Get-failed-disk-count-from-array-state.patch 0149-Monitor-don-t-assume-mdadm-parameter-is-a-block-devi.patch 0150-super1-Always-round-data-offset-to-1M.patch 0151-mdadm-r5cache-allow-adding-journal-to-array-without-.patch 0152-udev-rules-introduce-rules-for-cluster-md-to-confirm.patch 0153-Detail-correct-output-for-active-arrays.patch 0154-imsm-rebuild-from-2-disk-RAID10.patch (bsc#1069165) 0155-Error-messages-should-end-with-a-newline-character.patch 0156-Use-correct-syntax-for-passing-DEVLINKS-to-mdadm-fro.patch 0157-super1-only-set-clustered-flag-when-bitmap-is-presen.patch 0158-Don-t-use-exit-ERANGE.patch 0159-Monitor-containers-don-t-have-the-same-sysfs-propert.patch 0160-Monitor-Include-containers-in-spare-migration.patch 0161-Detail-differentiate-between-container-and-inactive-.patch 0162-mdadm-install-two-more-udev-rules-in-mdadm.spec.patch 0163-mdadm-set-journal_clean-after-scanning-all-disks.patch 0164-mdadm-bitmap-examine-bitmap-failed-when-bitmap-is-ex.patch 0165-mdopen-call-modprobe-md_mod-if-it-might-be-needed.patch 0166-lib-devid2kname-should-take-a-dev_t.patch 0167-sysfs_init_dev-take-a-dev_t-argument.patch 0168-Manage_subdevs-Use-a-dev_t.patch 0169-util-Code-is-80-characters-wide.patch 0170-Close-mdfd-before-returning-main-function.patch 0171-Grow-stop-previous-reshape-process-first.patch 0172-imsm-New-disk-controller-domains.patch 0173-Monitor-Check-redundancy-for-arrays.patch 0174-mdadm-grow-Component-size-must-be-larger-than-chunk-.patch 0175-mdadm-manpage-disable-bitmap_resize-for-external-fil.patch 0176-mdadm-fixes-some-trivial-typos-in-comments.patch (The following 12 patches are specifically for bsc#1068030) 0177-Don-t-abort-starting-the-array-if-kernel-does-not-su.patch 0178-super1-Add-support-for-multiple-ppls.patch 0179-imsm-Add-support-for-multiple-ppls.patch 0180-imsm-validate-multiple-ppls-during-assemble.patch 0181-Zeroout-whole-ppl-space-during-creation-force-assemb.patch 0182-imsm-switch-to-multiple-ppls-automatically-during-as.patch 0183-Grow-fix-switching-on-PPL-during-recovery.patch 0184-imsm-don-t-skip-resync-when-an-invalid-ppl-header-is.patch 0185-imsm-Write-empty-PPL-header-if-assembling-regular-cl.patch 0186-imsm-always-do-ppl-recovery-when-starting-a-rebuildi.patch 0187-imsm-use-correct-map-when-validating-ppl.patch 0188-imsm-write-initial-ppl-on-a-disk-added-for-rebuild.patch 0189-Grow-Use-all-80-characters.patch 0190-imsm-Set-disk-slot-number.patch (The following 1 patch is specifically for bsc#1069167) 0191-mdmon-get-safe-mode-delay-file-descriptor-early.patch 0192-mdadm-mdstat-fixup-a-number-of-broken-formatting.patch 0193-mdadm-mdstat-correct-the-strncmp-number-4-as-6.patch 0194-mdcheck-add-some-logging.patch 0195-mdcheck-improve-cleanup.patch 0196-Move-mdadm_env.sh-out-of-usr-lib-systemd.patch 0197-mdadm-grow-adding-a-test-to-ensure-resize-was-requir.patch 0198-mdadm-mdopen-create-new-function-create_named_array-.patch 0199-systemd-add-I-to-description-of-mdadm-last-resort-se.patch 0200-Incremental-Use-validate_geometry-instead-of-avail_s.patch 0201-imsm-fix-reading-scsi-serial.patch 0202-To-support-clustered-raid10.patch 0203-imsm-More-precise-message-when-spanned-raid-is-creat.patch 0204-sysfs-include-faulty-drive-in-disk-count.patch 0205-Monitor-msg-Don-t-print-error-message-if-mdmon-doesn.patch 0206-imsm-continue-resync-on-3-disk-RAID10.patch OBS-URL: https://build.opensuse.org/request/show/548207 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=156
334 lines
11 KiB
Diff
334 lines
11 KiB
Diff
From f566ef45d356f6dcd4ec54d294be8664770d8b84 Mon Sep 17 00:00:00 2001
|
|
From: Jes Sorensen <jsorensen@fb.com>
|
|
Date: Thu, 11 May 2017 16:56:55 -0400
|
|
Subject: [PATCH] Monitor: Fixup a pile of whitespace issues
|
|
Git-commit: f566ef45d356f6dcd4ec54d294be8664770d8b84
|
|
Patch-mainline: mdadm-4.0+
|
|
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
|
|
No code was hurt in this event
|
|
|
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
Signed-off-by: Coly Li <colyli@suse.de>
|
|
|
|
---
|
|
Monitor.c | 110 +++++++++++++++++++++++++++++++-------------------------------
|
|
1 file changed, 55 insertions(+), 55 deletions(-)
|
|
|
|
diff --git a/Monitor.c b/Monitor.c
|
|
index 83a6d10..0198a34 100644
|
|
--- a/Monitor.c
|
|
+++ b/Monitor.c
|
|
@@ -139,7 +139,7 @@ int Monitor(struct mddev_dev *devlist,
|
|
|
|
if (!alert_cmd) {
|
|
alert_cmd = conf_get_program();
|
|
- if (alert_cmd && ! c->scan)
|
|
+ if (alert_cmd && !c->scan)
|
|
pr_err("Monitor using program \"%s\" from config file\n",
|
|
alert_cmd);
|
|
}
|
|
@@ -164,8 +164,9 @@ int Monitor(struct mddev_dev *devlist,
|
|
|
|
if (devlist == NULL) {
|
|
mdlist = conf_get_ident(NULL);
|
|
- for (; mdlist; mdlist=mdlist->next) {
|
|
+ for (; mdlist; mdlist = mdlist->next) {
|
|
struct state *st;
|
|
+
|
|
if (mdlist->devname == NULL)
|
|
continue;
|
|
if (strcasecmp(mdlist->devname, "<ignore>") == 0)
|
|
@@ -189,7 +190,8 @@ int Monitor(struct mddev_dev *devlist,
|
|
}
|
|
} else {
|
|
struct mddev_dev *dv;
|
|
- for (dv=devlist ; dv; dv=dv->next) {
|
|
+
|
|
+ for (dv = devlist; dv; dv = dv->next) {
|
|
struct state *st = xcalloc(1, sizeof *st);
|
|
mdlist = conf_get_ident(dv->devname);
|
|
st->devname = xstrdup(dv->devname);
|
|
@@ -206,18 +208,18 @@ int Monitor(struct mddev_dev *devlist,
|
|
}
|
|
}
|
|
|
|
- while (! finished) {
|
|
+ while (!finished) {
|
|
int new_found = 0;
|
|
struct state *st, **stp;
|
|
int anydegraded = 0;
|
|
|
|
if (mdstat)
|
|
free_mdstat(mdstat);
|
|
- mdstat = mdstat_read(oneshot?0:1, 0);
|
|
+ mdstat = mdstat_read(oneshot ? 0 : 1, 0);
|
|
if (!mdstat)
|
|
mdstat_close();
|
|
|
|
- for (st=statelist; st; st=st->next)
|
|
+ for (st = statelist; st; st = st->next)
|
|
if (check_array(st, mdstat, c->test, &info,
|
|
increments, c->prefer))
|
|
anydegraded = 1;
|
|
@@ -291,8 +293,8 @@ static int make_daemon(char *pidfile)
|
|
}
|
|
close(0);
|
|
open("/dev/null", O_RDWR);
|
|
- dup2(0,1);
|
|
- dup2(0,2);
|
|
+ dup2(0, 1);
|
|
+ dup2(0, 2);
|
|
setsid();
|
|
return -1;
|
|
}
|
|
@@ -323,8 +325,7 @@ static int check_one_sharer(int scan)
|
|
fclose(fp);
|
|
}
|
|
if (scan) {
|
|
- if (mkdir(MDMON_DIR, S_IRWXU) < 0 &&
|
|
- errno != EEXIST) {
|
|
+ if (mkdir(MDMON_DIR, S_IRWXU) < 0 && errno != EEXIST) {
|
|
pr_err("Can't create autorebuild.pid file\n");
|
|
} else {
|
|
fp = fopen(path, "w");
|
|
@@ -347,7 +348,8 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
|
if (!info->alert_cmd && !info->mailaddr && !info->dosyslog) {
|
|
time_t now = time(0);
|
|
|
|
- printf("%1.15s: %s on %s %s\n", ctime(&now)+4, event, dev, disc?disc:"unknown device");
|
|
+ printf("%1.15s: %s on %s %s\n", ctime(&now) + 4,
|
|
+ event, dev, disc?disc:"unknown device");
|
|
}
|
|
if (info->alert_cmd) {
|
|
int pid = fork();
|
|
@@ -363,11 +365,10 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
|
exit(2);
|
|
}
|
|
}
|
|
- if (info->mailaddr &&
|
|
- (strncmp(event, "Fail", 4)==0 ||
|
|
- strncmp(event, "Test", 4)==0 ||
|
|
- strncmp(event, "Spares", 6)==0 ||
|
|
- strncmp(event, "Degrade", 7)==0)) {
|
|
+ if (info->mailaddr && (strncmp(event, "Fail", 4) == 0 ||
|
|
+ strncmp(event, "Test", 4) == 0 ||
|
|
+ strncmp(event, "Spares", 6) == 0 ||
|
|
+ strncmp(event, "Degrade", 7) == 0)) {
|
|
FILE *mp = popen(Sendmail, "w");
|
|
if (mp) {
|
|
FILE *mdstat;
|
|
@@ -377,7 +378,8 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
|
if (info->mailfrom)
|
|
fprintf(mp, "From: %s\n", info->mailfrom);
|
|
else
|
|
- fprintf(mp, "From: %s monitoring <root>\n", Name);
|
|
+ fprintf(mp, "From: %s monitoring <root>\n",
|
|
+ Name);
|
|
fprintf(mp, "To: %s\n", info->mailaddr);
|
|
fprintf(mp, "Subject: %s event on %s:%s\n\n",
|
|
event, dev, hname);
|
|
@@ -403,8 +405,9 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
|
int n;
|
|
fprintf(mp,
|
|
"\nP.S. The /proc/mdstat file currently contains the following:\n\n");
|
|
- while ( (n=fread(buf, 1, sizeof(buf), mdstat)) > 0)
|
|
- n=fwrite(buf, 1, n, mp);
|
|
+ while ((n = fread(buf, 1, sizeof(buf),
|
|
+ mdstat)) > 0)
|
|
+ n = fwrite(buf, 1, n, mp);
|
|
fclose(mdstat);
|
|
}
|
|
pclose(mp);
|
|
@@ -416,13 +419,13 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
|
|
/* Log at a different severity depending on the event.
|
|
*
|
|
* These are the critical events: */
|
|
- if (strncmp(event, "Fail", 4)==0 ||
|
|
- strncmp(event, "Degrade", 7)==0 ||
|
|
- strncmp(event, "DeviceDisappeared", 17)==0)
|
|
+ if (strncmp(event, "Fail", 4) == 0 ||
|
|
+ strncmp(event, "Degrade", 7) == 0 ||
|
|
+ strncmp(event, "DeviceDisappeared", 17) == 0)
|
|
priority = LOG_CRIT;
|
|
/* Good to know about, but are not failures: */
|
|
- else if (strncmp(event, "Rebuild", 7)==0 ||
|
|
- strncmp(event, "MoveSpare", 9)==0 ||
|
|
+ else if (strncmp(event, "Rebuild", 7) == 0 ||
|
|
+ strncmp(event, "MoveSpare", 9) == 0 ||
|
|
strncmp(event, "Spares", 6) != 0)
|
|
priority = LOG_WARNING;
|
|
/* Everything else: */
|
|
@@ -497,7 +500,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
goto out;
|
|
}
|
|
|
|
- for (mse2 = mdstat ; mse2 ; mse2=mse2->next)
|
|
+ for (mse2 = mdstat; mse2; mse2 = mse2->next)
|
|
if (strcmp(mse2->devnm, st->devnm) == 0) {
|
|
mse2->devnm[0] = 0; /* flag it as "used" */
|
|
mse = mse2;
|
|
@@ -568,7 +571,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
char cnt[80];
|
|
snprintf(cnt, sizeof(cnt),
|
|
" mismatches found: %d (on raid level %d)",
|
|
- sra->mismatch_cnt, sra->array.level);
|
|
+ sra->mismatch_cnt, sra->array.level);
|
|
alert("RebuildFinished", dev, cnt, ainfo);
|
|
} else
|
|
alert("RebuildFinished", dev, NULL, ainfo);
|
|
@@ -594,7 +597,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
strncmp(mse->metadata_version, "external:", 9) == 0 &&
|
|
is_subarray(mse->metadata_version+9)) {
|
|
char *sl;
|
|
- strcpy(st->parent_devnm, mse->metadata_version+10);
|
|
+ strcpy(st->parent_devnm, mse->metadata_version + 10);
|
|
sl = strchr(st->parent_devnm, '/');
|
|
if (sl)
|
|
*sl = 0;
|
|
@@ -603,9 +606,9 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
|
if (st->metadata == NULL && st->parent_devnm[0] == 0)
|
|
st->metadata = super_by_fd(fd, NULL);
|
|
|
|
- for (i=0; i<MAX_DISKS; i++) {
|
|
- mdu_disk_info_t disc = {0,0,0,0,0};
|
|
- int newstate=0;
|
|
+ for (i = 0; i < MAX_DISKS; i++) {
|
|
+ mdu_disk_info_t disc = {0, 0, 0, 0, 0};
|
|
+ int newstate = 0;
|
|
int change;
|
|
char *dv = NULL;
|
|
disc.number = i;
|
|
@@ -668,12 +671,10 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
|
|
int new_found = 0;
|
|
char *name;
|
|
|
|
- for (mse=mdstat; mse; mse=mse->next)
|
|
- if (mse->devnm[0] &&
|
|
- (!mse->level || /* retrieve containers */
|
|
- (strcmp(mse->level, "raid0") != 0 &&
|
|
- strcmp(mse->level, "linear") != 0))
|
|
- ) {
|
|
+ for (mse = mdstat; mse; mse = mse->next)
|
|
+ if (mse->devnm[0] && (!mse->level || /* retrieve containers */
|
|
+ (strcmp(mse->level, "raid0") != 0 &&
|
|
+ strcmp(mse->level, "linear") != 0))) {
|
|
struct state *st = xcalloc(1, sizeof *st);
|
|
mdu_array_info_t array;
|
|
int fd;
|
|
@@ -707,7 +708,8 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
|
|
st->percent = RESYNC_UNKNOWN;
|
|
st->expected_spares = -1;
|
|
if (mse->metadata_version &&
|
|
- strncmp(mse->metadata_version, "external:", 9) == 0 &&
|
|
+ strncmp(mse->metadata_version,
|
|
+ "external:", 9) == 0 &&
|
|
is_subarray(mse->metadata_version+9)) {
|
|
char *sl;
|
|
strcpy(st->parent_devnm,
|
|
@@ -729,8 +731,7 @@ static int get_required_spare_criteria(struct state *st,
|
|
{
|
|
int fd;
|
|
|
|
- if (!st->metadata ||
|
|
- !st->metadata->ss->get_spare_criteria) {
|
|
+ if (!st->metadata || !st->metadata->ss->get_spare_criteria) {
|
|
sc->min_size = 0;
|
|
sc->sector_size = 0;
|
|
return 0;
|
|
@@ -779,14 +780,13 @@ static int check_donor(struct state *from, struct state *to)
|
|
}
|
|
|
|
static dev_t choose_spare(struct state *from, struct state *to,
|
|
- struct domainlist *domlist, struct spare_criteria *sc)
|
|
+ struct domainlist *domlist, struct spare_criteria *sc)
|
|
{
|
|
int d;
|
|
dev_t dev = 0;
|
|
|
|
for (d = from->raid; !dev && d < MAX_DISKS; d++) {
|
|
- if (from->devid[d] > 0 &&
|
|
- from->devstate[d] == 0) {
|
|
+ if (from->devid[d] > 0 && from->devstate[d] == 0) {
|
|
struct dev_policy *pol;
|
|
unsigned long long dev_size;
|
|
unsigned int dev_sector_size;
|
|
@@ -810,7 +810,8 @@ static dev_t choose_spare(struct state *from, struct state *to,
|
|
if (from->spare_group)
|
|
pol_add(&pol, pol_domain,
|
|
from->spare_group, NULL);
|
|
- if (domain_test(domlist, pol, to->metadata->ss->name) == 1)
|
|
+ if (domain_test(domlist, pol,
|
|
+ to->metadata->ss->name) == 1)
|
|
dev = from->devid[d];
|
|
dev_policy_free(pol);
|
|
}
|
|
@@ -857,8 +858,8 @@ static dev_t container_choose_spare(struct state *from, struct state *to,
|
|
}
|
|
dp = list->devs;
|
|
while (dp) {
|
|
- if (dp->disk.state & (1<<MD_DISK_SYNC) &&
|
|
- !(dp->disk.state & (1<<MD_DISK_FAULTY)))
|
|
+ if (dp->disk.state & (1 << MD_DISK_SYNC) &&
|
|
+ !(dp->disk.state & (1 << MD_DISK_FAULTY)))
|
|
active_cnt++;
|
|
dp = dp->next;
|
|
}
|
|
@@ -891,8 +892,7 @@ static void try_spare_migration(struct state *statelist, struct alert_info *info
|
|
|
|
link_containers_with_subarrays(statelist);
|
|
for (st = statelist; st; st = st->next)
|
|
- if (st->active < st->raid &&
|
|
- st->spare == 0 && !st->err) {
|
|
+ if (st->active < st->raid && st->spare == 0 && !st->err) {
|
|
struct domainlist *domlist = NULL;
|
|
int d;
|
|
struct state *to = st;
|
|
@@ -940,9 +940,11 @@ static void try_spare_migration(struct state *statelist, struct alert_info *info
|
|
else
|
|
devid = choose_spare(from, to, domlist,
|
|
&sc);
|
|
- if (devid > 0
|
|
- && move_spare(from->devname, to->devname, devid)) {
|
|
- alert("MoveSpare", to->devname, from->devname, info);
|
|
+ if (devid > 0 &&
|
|
+ move_spare(from->devname, to->devname,
|
|
+ devid)) {
|
|
+ alert("MoveSpare", to->devname,
|
|
+ from->devname, info);
|
|
break;
|
|
}
|
|
}
|
|
@@ -967,8 +969,7 @@ static void link_containers_with_subarrays(struct state *list)
|
|
for (st = list; st; st = st->next)
|
|
if (st->parent_devnm[0])
|
|
for (cont = list; cont; cont = cont->next)
|
|
- if (!cont->err &&
|
|
- cont->parent_devnm[0] == 0 &&
|
|
+ if (!cont->err && cont->parent_devnm[0] == 0 &&
|
|
strcmp(cont->devnm, st->parent_devnm) == 0) {
|
|
st->parent = cont;
|
|
st->subarray = cont->subarray;
|
|
@@ -992,7 +993,7 @@ int Wait(char *dev)
|
|
struct mdstat_ent *ms = mdstat_read(1, 0);
|
|
struct mdstat_ent *e;
|
|
|
|
- for (e=ms ; e; e=e->next)
|
|
+ for (e = ms; e; e = e->next)
|
|
if (strcmp(e->devnm, devnm) == 0)
|
|
break;
|
|
|
|
@@ -1115,8 +1116,7 @@ int WaitClean(char *dev, int sock, int verbose)
|
|
} else
|
|
rv = 1;
|
|
if (rv && verbose)
|
|
- pr_err("Error waiting for %s to be clean\n",
|
|
- dev);
|
|
+ pr_err("Error waiting for %s to be clean\n", dev);
|
|
|
|
/* restore the original safe_mode_delay */
|
|
sysfs_set_safemode(mdi, mdi->safe_mode_delay);
|
|
--
|
|
2.13.6
|
|
|