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
459 lines
16 KiB
Diff
459 lines
16 KiB
Diff
From fc54fe7a7e77fdb6316d332d4d41d0ed2293d6be Mon Sep 17 00:00:00 2001
|
|
From: Jes Sorensen <jsorensen@fb.com>
|
|
Date: Tue, 16 May 2017 13:52:15 -0400
|
|
Subject: [PATCH] mdadm: Fixup a large number of bad formatting of logical
|
|
operators
|
|
Git-commit: fc54fe7a7e77fdb6316d332d4d41d0ed2293d6be
|
|
Patch-mainline: mdadm-4.0+
|
|
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
|
|
Logical oprators never belong at the beginning of a line.
|
|
|
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
Signed-off-by: Coly Li <colyli@suse.de>
|
|
|
|
---
|
|
Assemble.c | 23 ++++++++++-------------
|
|
Grow.c | 34 ++++++++++++++++------------------
|
|
Manage.c | 29 +++++++++++++----------------
|
|
managemon.c | 10 +++++-----
|
|
mdadm.c | 3 +--
|
|
monitor.c | 4 ++--
|
|
super-ddf.c | 33 ++++++++++++++++-----------------
|
|
super-intel.c | 10 +++++-----
|
|
util.c | 20 ++++++++------------
|
|
9 files changed, 76 insertions(+), 90 deletions(-)
|
|
|
|
diff --git a/Assemble.c b/Assemble.c
|
|
index 30d5838..1b1905c 100644
|
|
--- a/Assemble.c
|
|
+++ b/Assemble.c
|
|
@@ -753,12 +753,12 @@ static int load_devices(struct devs *devices, char *devmap,
|
|
bestcnt = newbestcnt;
|
|
}
|
|
if (best[i] >=0 &&
|
|
- devices[best[i]].i.events
|
|
- == devices[devcnt].i.events
|
|
- && (devices[best[i]].i.disk.minor
|
|
- != devices[devcnt].i.disk.minor)
|
|
- && st->ss == &super0
|
|
- && content->array.level != LEVEL_MULTIPATH) {
|
|
+ devices[best[i]].i.events ==
|
|
+ devices[devcnt].i.events &&
|
|
+ (devices[best[i]].i.disk.minor
|
|
+ != devices[devcnt].i.disk.minor) &&
|
|
+ st->ss == &super0 &&
|
|
+ content->array.level != LEVEL_MULTIPATH) {
|
|
/* two different devices with identical superblock.
|
|
* Could be a mis-detection caused by overlapping
|
|
* partitions. fail-safe.
|
|
@@ -801,14 +801,11 @@ static int force_array(struct mdinfo *content,
|
|
int okcnt = 0;
|
|
while (!enough(content->array.level, content->array.raid_disks,
|
|
content->array.layout, 1,
|
|
- avail)
|
|
- ||
|
|
+ avail) ||
|
|
(content->reshape_active && content->delta_disks > 0 &&
|
|
!enough(content->array.level, (content->array.raid_disks
|
|
- content->delta_disks),
|
|
- content->new_layout, 1,
|
|
- avail)
|
|
- )) {
|
|
+ content->new_layout, 1, avail))) {
|
|
/* Choose the newest best drive which is
|
|
* not up-to-date, update the superblock
|
|
* and add it.
|
|
@@ -1303,8 +1300,8 @@ int Assemble(struct supertype *st, char *mddev,
|
|
int mdfd;
|
|
int clean;
|
|
int auto_assem = (mddev == NULL && !ident->uuid_set &&
|
|
- ident->super_minor == UnSet && ident->name[0] == 0
|
|
- && (ident->container == NULL || ident->member == NULL));
|
|
+ ident->super_minor == UnSet && ident->name[0] == 0 &&
|
|
+ (ident->container == NULL || ident->member == NULL));
|
|
struct devs *devices;
|
|
char *devmap;
|
|
int *best = NULL; /* indexed by raid_disk */
|
|
diff --git a/Grow.c b/Grow.c
|
|
index a527436..39110b8 100644
|
|
--- a/Grow.c
|
|
+++ b/Grow.c
|
|
@@ -813,8 +813,8 @@ static void unfreeze(struct supertype *st)
|
|
char buf[20];
|
|
|
|
if (sra &&
|
|
- sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0
|
|
- && strcmp(buf, "frozen\n") == 0)
|
|
+ sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0 &&
|
|
+ strcmp(buf, "frozen\n") == 0)
|
|
sysfs_set_str(sra, NULL, "sync_action", "idle");
|
|
sysfs_free(sra);
|
|
}
|
|
@@ -2902,8 +2902,8 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
if (disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
found++;
|
|
- if ((disk.state & (1 << MD_DISK_ACTIVE))
|
|
- && disk.raid_disk < data_disks)
|
|
+ if ((disk.state & (1 << MD_DISK_ACTIVE)) &&
|
|
+ disk.raid_disk < data_disks)
|
|
/* keep this */
|
|
continue;
|
|
ioctl(fd, HOT_REMOVE_DISK,
|
|
@@ -2921,8 +2921,8 @@ static int impose_level(int fd, int level, char *devname, int verbose)
|
|
if (disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
found++;
|
|
- if ((disk.state & (1 << MD_DISK_ACTIVE))
|
|
- && disk.raid_disk < data_disks)
|
|
+ if ((disk.state & (1 << MD_DISK_ACTIVE)) &&
|
|
+ disk.raid_disk < data_disks)
|
|
/* keep this */
|
|
continue;
|
|
ioctl(fd, SET_DISK_FAULTY,
|
|
@@ -3597,9 +3597,8 @@ started:
|
|
}
|
|
|
|
if (!st->ss->external &&
|
|
- !(reshape.before.data_disks != reshape.after.data_disks
|
|
- && info->custom_array_size) &&
|
|
- info->new_level == reshape.level &&
|
|
+ !(reshape.before.data_disks != reshape.after.data_disks &&
|
|
+ info->custom_array_size) && info->new_level == reshape.level &&
|
|
!forked) {
|
|
/* no need to wait for the reshape to finish as
|
|
* there is nothing more to do.
|
|
@@ -4092,14 +4091,14 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
|
|
* before setting 'sync_action' to 'idle'.
|
|
* So we need these extra tests.
|
|
*/
|
|
- if (completed == 0 && advancing
|
|
- && strncmp(action, "idle", 4) == 0
|
|
- && info->reshape_progress > 0)
|
|
+ if (completed == 0 && advancing &&
|
|
+ strncmp(action, "idle", 4) == 0 &&
|
|
+ info->reshape_progress > 0)
|
|
break;
|
|
- if (completed == 0 && !advancing
|
|
- && strncmp(action, "idle", 4) == 0
|
|
- && info->reshape_progress < (info->component_size
|
|
- * reshape->after.data_disks))
|
|
+ if (completed == 0 && !advancing &&
|
|
+ strncmp(action, "idle", 4) == 0 &&
|
|
+ info->reshape_progress < (info->component_size
|
|
+ * reshape->after.data_disks))
|
|
break;
|
|
sysfs_wait(fd, NULL);
|
|
if (sysfs_fd_get_ll(fd, &completed) < 0)
|
|
@@ -4787,8 +4786,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
|
|
/* reshape_progress is increasing */
|
|
if ((__le64_to_cpu(bsb.arraystart)
|
|
+ __le64_to_cpu(bsb.length)
|
|
- < info->reshape_progress)
|
|
- &&
|
|
+ < info->reshape_progress) &&
|
|
(__le64_to_cpu(bsb.arraystart2)
|
|
+ __le64_to_cpu(bsb.length2)
|
|
< info->reshape_progress))
|
|
diff --git a/Manage.c b/Manage.c
|
|
index 467efb7..cee5dad 100644
|
|
--- a/Manage.c
|
|
+++ b/Manage.c
|
|
@@ -204,11 +204,9 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
|
|
count = 5;
|
|
while (((fd = ((devname[0] == '/')
|
|
?open(devname, O_RDONLY|O_EXCL)
|
|
- :open_dev_flags(devnm, O_RDONLY|O_EXCL))) < 0
|
|
- || strcmp(fd2devnm(fd), devnm) != 0)
|
|
- && container[0]
|
|
- && mdmon_running(container)
|
|
- && count) {
|
|
+ :open_dev_flags(devnm, O_RDONLY|O_EXCL))) < 0 ||
|
|
+ strcmp(fd2devnm(fd), devnm) != 0) && container[0] &&
|
|
+ mdmon_running(container) && count) {
|
|
/* Can't open, so something might be wrong. However it
|
|
* is a container, so we might be racing with mdmon, so
|
|
* retry for a bit.
|
|
@@ -244,8 +242,8 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry)
|
|
while (count &&
|
|
(err = sysfs_set_str(mdi, NULL,
|
|
"array_state",
|
|
- "inactive")) < 0
|
|
- && errno == EBUSY) {
|
|
+ "inactive")) < 0 &&
|
|
+ errno == EBUSY) {
|
|
usleep(200000);
|
|
count--;
|
|
}
|
|
@@ -447,9 +445,8 @@ done:
|
|
* so it is reasonable to retry for a while - 5 seconds.
|
|
*/
|
|
count = 25; err = 0;
|
|
- while (count && fd >= 0
|
|
- && (err = ioctl(fd, STOP_ARRAY, NULL)) < 0
|
|
- && errno == EBUSY) {
|
|
+ while (count && fd >= 0 &&
|
|
+ (err = ioctl(fd, STOP_ARRAY, NULL)) < 0 && errno == EBUSY) {
|
|
usleep(200000);
|
|
count --;
|
|
}
|
|
@@ -795,8 +792,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
|
|
break;
|
|
}
|
|
/* FIXME this is a bad test to be using */
|
|
- if (!tst->sb && (dv->disposition != 'a'
|
|
- && dv->disposition != 'S')) {
|
|
+ if (!tst->sb && (dv->disposition != 'a' &&
|
|
+ dv->disposition != 'S')) {
|
|
/* we are re-adding a device to a
|
|
* completely dead array - have to depend
|
|
* on kernel to check
|
|
@@ -1393,8 +1390,7 @@ int Manage_subdevs(char *devname, int fd,
|
|
|
|
if (strcmp(dv->devname, "failed") == 0 ||
|
|
strcmp(dv->devname, "faulty") == 0) {
|
|
- if (dv->disposition != 'A'
|
|
- && dv->disposition != 'r') {
|
|
+ if (dv->disposition != 'A' && dv->disposition != 'r') {
|
|
pr_err("%s only meaningful with -r or --re-add, not -%c\n",
|
|
dv->devname, dv->disposition);
|
|
goto abort;
|
|
@@ -1499,8 +1495,9 @@ int Manage_subdevs(char *devname, int fd,
|
|
goto abort;
|
|
}
|
|
}
|
|
- } else if ((dv->disposition == 'r' || dv->disposition == 'f')
|
|
- && get_maj_min(dv->devname, &mj, &mn)) {
|
|
+ } else if ((dv->disposition == 'r' ||
|
|
+ dv->disposition == 'f') &&
|
|
+ get_maj_min(dv->devname, &mj, &mn)) {
|
|
/* for 'fail' and 'remove', the device might
|
|
* not exist.
|
|
*/
|
|
diff --git a/managemon.c b/managemon.c
|
|
index 3c1d4cb..0a33fc9 100644
|
|
--- a/managemon.c
|
|
+++ b/managemon.c
|
|
@@ -499,9 +499,9 @@ static void manage_member(struct mdstat_ent *mdstat,
|
|
frozen = 1; /* can't read metadata_version assume the worst */
|
|
|
|
/* If sync_action is not 'idle' then don't try recovery now */
|
|
- if (!frozen
|
|
- && sysfs_get_str(&a->info, NULL, "sync_action", buf, sizeof(buf)) > 0
|
|
- && strncmp(buf, "idle", 4) != 0)
|
|
+ if (!frozen &&
|
|
+ sysfs_get_str(&a->info, NULL, "sync_action",
|
|
+ buf, sizeof(buf)) > 0 && strncmp(buf, "idle", 4) != 0)
|
|
frozen = 1;
|
|
|
|
if (mdstat->level) {
|
|
@@ -626,8 +626,8 @@ static void manage_member(struct mdstat_ent *mdstat,
|
|
newd = xmalloc(sizeof(*newd));
|
|
disk_init_and_add(newd, d, newa);
|
|
}
|
|
- if (sysfs_get_ll(info, NULL, "array_size", &array_size) == 0
|
|
- && a->info.custom_array_size > array_size*2) {
|
|
+ if (sysfs_get_ll(info, NULL, "array_size", &array_size) == 0 &&
|
|
+ a->info.custom_array_size > array_size*2) {
|
|
sysfs_set_num(info, NULL, "array_size",
|
|
a->info.custom_array_size/2);
|
|
}
|
|
diff --git a/mdadm.c b/mdadm.c
|
|
index b689e32..70b16f2 100644
|
|
--- a/mdadm.c
|
|
+++ b/mdadm.c
|
|
@@ -1843,8 +1843,7 @@ static int misc_scan(char devmode, struct context *c)
|
|
if (members != member)
|
|
continue;
|
|
me = map_by_devnm(&map, e->devnm);
|
|
- if (me && me->path
|
|
- && strcmp(me->path, "/unknown") != 0)
|
|
+ if (me && me->path && strcmp(me->path, "/unknown") != 0)
|
|
name = me->path;
|
|
if (name == NULL || stat(name, &stb) != 0)
|
|
name = get_md_name(e->devnm);
|
|
diff --git a/monitor.c b/monitor.c
|
|
index 00b7c68..81537ed 100644
|
|
--- a/monitor.c
|
|
+++ b/monitor.c
|
|
@@ -576,8 +576,8 @@ static int read_and_act(struct active_array *a, fd_set *fds)
|
|
a->last_checkpoint = sync_completed;
|
|
a->container->ss->set_array_state(a, a->curr_state <= clean);
|
|
} else if ((a->curr_action == idle && a->prev_action == reshape) ||
|
|
- (a->curr_action == reshape
|
|
- && sync_completed > a->last_checkpoint) ) {
|
|
+ (a->curr_action == reshape &&
|
|
+ sync_completed > a->last_checkpoint)) {
|
|
/* Reshape has progressed or completed so we need to
|
|
* update the array state - and possibly the array size
|
|
*/
|
|
diff --git a/super-ddf.c b/super-ddf.c
|
|
index 50197a8..769eded 100644
|
|
--- a/super-ddf.c
|
|
+++ b/super-ddf.c
|
|
@@ -670,8 +670,8 @@ static int layout_md2ddf(const mdu_array_info_t *array,
|
|
sec_elmnt_count = array->raid_disks / 2;
|
|
srl = DDF_2SPANNED;
|
|
prl = DDF_RAID1;
|
|
- } else if (array->raid_disks % 3 == 0
|
|
- && array->layout == 0x103) {
|
|
+ } else if (array->raid_disks % 3 == 0 &&
|
|
+ array->layout == 0x103) {
|
|
rlq = DDF_RAID1_MULTI;
|
|
prim_elmnt_count = cpu_to_be16(3);
|
|
sec_elmnt_count = array->raid_disks / 3;
|
|
@@ -853,8 +853,8 @@ static void *load_section(int fd, struct ddf_super *super, void *buf,
|
|
int dofree = (buf == NULL);
|
|
|
|
if (check)
|
|
- if (len != 2 && len != 8 && len != 32
|
|
- && len != 128 && len != 512)
|
|
+ if (len != 2 && len != 8 && len != 32 &&
|
|
+ len != 128 && len != 512)
|
|
return NULL;
|
|
|
|
if (len > 1024)
|
|
@@ -2028,8 +2028,8 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m
|
|
be32_to_cpu(ddf->phys->entries[e].refnum) == 0xffffffff)
|
|
e++;
|
|
if (i < info->array.raid_disks && e < max &&
|
|
- !(be16_to_cpu(ddf->phys->entries[e].state)
|
|
- & DDF_Failed))
|
|
+ !(be16_to_cpu(ddf->phys->entries[e].state) &
|
|
+ DDF_Failed))
|
|
map[i] = 1;
|
|
else
|
|
map[i] = 0;
|
|
@@ -2114,11 +2114,10 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
|
|
info->resync_start = 0;
|
|
info->reshape_active = 0;
|
|
info->recovery_blocked = 0;
|
|
- if (!(ddf->virt->entries[info->container_member].state
|
|
- & DDF_state_inconsistent) &&
|
|
- (ddf->virt->entries[info->container_member].init_state
|
|
- & DDF_initstate_mask)
|
|
- == DDF_init_full)
|
|
+ if (!(ddf->virt->entries[info->container_member].state &
|
|
+ DDF_state_inconsistent) &&
|
|
+ (ddf->virt->entries[info->container_member].init_state &
|
|
+ DDF_initstate_mask) == DDF_init_full)
|
|
info->resync_start = MaxSector;
|
|
|
|
uuid_from_super_ddf(st, info->uuid);
|
|
@@ -2135,7 +2134,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
|
|
if (map)
|
|
for (j = 0; j < map_disks; j++) {
|
|
map[j] = 0;
|
|
- if (j < info->array.raid_disks) {
|
|
+ if (j < info->array.raid_disks) {
|
|
int i = find_phys(ddf, vc->conf.phys_refnum[j]);
|
|
if (i >= 0 &&
|
|
(be16_to_cpu(ddf->phys->entries[i].state)
|
|
@@ -4618,9 +4617,9 @@ static void ddf_remove_failed(struct ddf_super *ddf)
|
|
0xFFFFFFFF)
|
|
continue;
|
|
if (be16_and(ddf->phys->entries[pdnum].state,
|
|
- cpu_to_be16(DDF_Failed))
|
|
- && be16_and(ddf->phys->entries[pdnum].state,
|
|
- cpu_to_be16(DDF_Transition))) {
|
|
+ cpu_to_be16(DDF_Failed)) &&
|
|
+ be16_and(ddf->phys->entries[pdnum].state,
|
|
+ cpu_to_be16(DDF_Transition))) {
|
|
/* skip this one unless in dlist*/
|
|
for (dl = ddf->dlist; dl; dl = dl->next)
|
|
if (dl->pdnum == (int)pdnum)
|
|
@@ -5151,8 +5150,8 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
|
|
vc = (struct vd_config *)(mu->buf
|
|
+ i_sec * ddf->conf_rec_len * 512);
|
|
for (dl = ddf->dlist; dl; dl = dl->next)
|
|
- if (dl->major == di->disk.major
|
|
- && dl->minor == di->disk.minor)
|
|
+ if (dl->major == di->disk.major &&
|
|
+ dl->minor == di->disk.minor)
|
|
break;
|
|
if (!dl || dl->pdnum < 0) {
|
|
pr_err("BUG: can't find disk %d (%d/%d)\n",
|
|
diff --git a/super-intel.c b/super-intel.c
|
|
index 8ca80d3..c84e755 100644
|
|
--- a/super-intel.c
|
|
+++ b/super-intel.c
|
|
@@ -4165,8 +4165,8 @@ int check_mpb_migr_compatibility(struct intel_super *super)
|
|
if (pba_of_lba0(map0) != pba_of_lba0(map1))
|
|
/* migration optimization area was used */
|
|
return -1;
|
|
- if (migr_rec->ascending_migr == 0
|
|
- && migr_rec->dest_depth_per_unit > 0)
|
|
+ if (migr_rec->ascending_migr == 0 &&
|
|
+ migr_rec->dest_depth_per_unit > 0)
|
|
/* descending reshape not supported yet */
|
|
return -1;
|
|
}
|
|
@@ -6442,7 +6442,7 @@ active_arrays_by_format(char *name, char* hba, struct md_list **devlist,
|
|
|
|
for (memb = mdstat ; memb ; memb = memb->next) {
|
|
if (memb->metadata_version &&
|
|
- (strncmp(memb->metadata_version, "external:", 9) == 0) &&
|
|
+ (strncmp(memb->metadata_version, "external:", 9) == 0) &&
|
|
(strcmp(&memb->metadata_version[9], name) == 0) &&
|
|
!is_subarray(memb->metadata_version+9) &&
|
|
memb->members) {
|
|
@@ -11640,8 +11640,8 @@ static int imsm_manage_reshape(
|
|
|
|
/* Find volume during the reshape */
|
|
for (dv = super->devlist; dv; dv = dv->next) {
|
|
- if (dv->dev->vol.migr_type == MIGR_GEN_MIGR
|
|
- && dv->dev->vol.migr_state == 1) {
|
|
+ if (dv->dev->vol.migr_type == MIGR_GEN_MIGR &&
|
|
+ dv->dev->vol.migr_state == 1) {
|
|
dev = dv->dev;
|
|
migr_vol_qan++;
|
|
}
|
|
diff --git a/util.c b/util.c
|
|
index fc9cd3f..0564c0b 100644
|
|
--- a/util.c
|
|
+++ b/util.c
|
|
@@ -1014,21 +1014,18 @@ char *get_md_name(char *devnm)
|
|
if (strncmp(devnm, "md_", 3) == 0) {
|
|
snprintf(devname, sizeof(devname), "/dev/md/%s",
|
|
devnm + 3);
|
|
- if (stat(devname, &stb) == 0
|
|
- && (S_IFMT&stb.st_mode) == S_IFBLK
|
|
- && (stb.st_rdev == rdev))
|
|
+ if (stat(devname, &stb) == 0 &&
|
|
+ (S_IFMT&stb.st_mode) == S_IFBLK && (stb.st_rdev == rdev))
|
|
return devname;
|
|
}
|
|
snprintf(devname, sizeof(devname), "/dev/%s", devnm);
|
|
- if (stat(devname, &stb) == 0
|
|
- && (S_IFMT&stb.st_mode) == S_IFBLK
|
|
- && (stb.st_rdev == rdev))
|
|
+ if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK &&
|
|
+ (stb.st_rdev == rdev))
|
|
return devname;
|
|
|
|
snprintf(devname, sizeof(devname), "/dev/md/%s", devnm+2);
|
|
- if (stat(devname, &stb) == 0
|
|
- && (S_IFMT&stb.st_mode) == S_IFBLK
|
|
- && (stb.st_rdev == rdev))
|
|
+ if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK &&
|
|
+ (stb.st_rdev == rdev))
|
|
return devname;
|
|
|
|
dn = map_dev(major(rdev), minor(rdev), 0);
|
|
@@ -1039,9 +1036,8 @@ char *get_md_name(char *devnm)
|
|
if (errno != EEXIST)
|
|
return NULL;
|
|
|
|
- if (stat(devname, &stb) == 0
|
|
- && (S_IFMT&stb.st_mode) == S_IFBLK
|
|
- && (stb.st_rdev == rdev))
|
|
+ if (stat(devname, &stb) == 0 && (S_IFMT&stb.st_mode) == S_IFBLK &&
|
|
+ (stb.st_rdev == rdev))
|
|
return devname;
|
|
unlink(devname);
|
|
return NULL;
|
|
--
|
|
2.13.6
|
|
|