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
526 lines
18 KiB
Diff
526 lines
18 KiB
Diff
From 5737086ed7a39e4d940ed1459d1afad359c3182c Mon Sep 17 00:00:00 2001
|
|
From: Jes Sorensen <jsorensen@fb.com>
|
|
Date: Tue, 25 Apr 2017 12:21:39 -0400
|
|
Subject: [PATCH] Detail: Respect code lines are 80 character wide
|
|
Git-commit: 5737086ed7a39e4d940ed1459d1afad359c3182c
|
|
Patch-mainline: mdadm-4.0+
|
|
References: bsc#1069165, bsc#1069167, bsc#1068030
|
|
|
|
In addition apply spaces and don'f do 'if () action()' on the same line.
|
|
|
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
Signed-off-by: Coly Li <colyli@suse.de>
|
|
|
|
---
|
|
Detail.c | 239 ++++++++++++++++++++++++++++++++++++---------------------------
|
|
1 file changed, 138 insertions(+), 101 deletions(-)
|
|
|
|
diff --git a/Detail.c b/Detail.c
|
|
index eb69276..ceb21b1 100644
|
|
--- a/Detail.c
|
|
+++ b/Detail.c
|
|
@@ -157,8 +157,7 @@ int Detail(char *dev, struct context *c)
|
|
if (md_get_disk_info(fd, &disk) < 0)
|
|
continue;
|
|
if (d >= array.raid_disks &&
|
|
- disk.major == 0 &&
|
|
- disk.minor == 0)
|
|
+ disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
}
|
|
|
|
@@ -236,7 +235,8 @@ int Detail(char *dev, struct context *c)
|
|
printf("MD_METADATA=%s\n", sra->text_version);
|
|
else
|
|
printf("MD_METADATA=%d.%d\n",
|
|
- array.major_version, array.minor_version);
|
|
+ array.major_version,
|
|
+ array.minor_version);
|
|
}
|
|
|
|
if (st && st->sb && info) {
|
|
@@ -244,12 +244,12 @@ int Detail(char *dev, struct context *c)
|
|
struct map_ent *mp, *map = NULL;
|
|
|
|
fname_from_uuid(st, info, nbuf, ':');
|
|
- printf("MD_UUID=%s\n", nbuf+5);
|
|
+ printf("MD_UUID=%s\n", nbuf + 5);
|
|
mp = map_by_uuid(&map, info->uuid);
|
|
if (mp && mp->path &&
|
|
strncmp(mp->path, "/dev/md/", 8) == 0) {
|
|
printf("MD_DEVNAME=");
|
|
- print_escape(mp->path+8);
|
|
+ print_escape(mp->path + 8);
|
|
putchar('\n');
|
|
}
|
|
|
|
@@ -273,11 +273,12 @@ int Detail(char *dev, struct context *c)
|
|
if (sra) {
|
|
struct mdinfo *mdi;
|
|
for (mdi = sra->devs; mdi; mdi = mdi->next) {
|
|
- char *path =
|
|
- map_dev(mdi->disk.major,
|
|
- mdi->disk.minor, 0);
|
|
+ char *path;
|
|
char *sysdev = xstrdup(mdi->sys_name + 1);
|
|
char *cp;
|
|
+
|
|
+ path = map_dev(mdi->disk.major,
|
|
+ mdi->disk.minor, 0);
|
|
for (cp = sysdev; *cp; cp++)
|
|
if (!isalnum(*cp))
|
|
*cp = '_';
|
|
@@ -299,19 +300,19 @@ int Detail(char *dev, struct context *c)
|
|
|
|
disks = xmalloc(max_disks * 2 * sizeof(mdu_disk_info_t));
|
|
for (d = 0; d < max_disks * 2; d++) {
|
|
- disks[d].state = (1<<MD_DISK_REMOVED);
|
|
+ disks[d].state = (1 << MD_DISK_REMOVED);
|
|
disks[d].major = disks[d].minor = 0;
|
|
disks[d].number = -1;
|
|
- disks[d].raid_disk = d/2;
|
|
+ disks[d].raid_disk = d / 2;
|
|
}
|
|
|
|
- next = array.raid_disks*2;
|
|
+ next = array.raid_disks * 2;
|
|
if (inactive) {
|
|
struct mdinfo *mdi;
|
|
if (sra != NULL)
|
|
for (mdi = sra->devs; mdi; mdi = mdi->next) {
|
|
disks[next++] = mdi->disk;
|
|
- disks[next-1].number = -1;
|
|
+ disks[next - 1].number = -1;
|
|
}
|
|
} else for (d = 0; d < max_disks; d++) {
|
|
mdu_disk_info_t disk;
|
|
@@ -324,21 +325,23 @@ int Detail(char *dev, struct context *c)
|
|
}
|
|
if (disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
- if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks
|
|
- && disks[disk.raid_disk*2].state == (1<<MD_DISK_REMOVED)
|
|
- && ((disk.state & (1<<MD_DISK_JOURNAL)) == 0))
|
|
- disks[disk.raid_disk*2] = disk;
|
|
- else if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks
|
|
- && disks[disk.raid_disk*2+1].state == (1<<MD_DISK_REMOVED)
|
|
- && !(disk.state & (1<<MD_DISK_JOURNAL)))
|
|
- disks[disk.raid_disk*2+1] = disk;
|
|
- else if (next < max_disks*2)
|
|
+ if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks &&
|
|
+ disks[disk.raid_disk * 2].state == (1 << MD_DISK_REMOVED) &&
|
|
+ ((disk.state & (1 << MD_DISK_JOURNAL)) == 0))
|
|
+ disks[disk.raid_disk * 2] = disk;
|
|
+ else if (disk.raid_disk >= 0 &&
|
|
+ disk.raid_disk < array.raid_disks &&
|
|
+ disks[disk.raid_disk * 2 + 1].state ==
|
|
+ (1 << MD_DISK_REMOVED) &&
|
|
+ !(disk.state & (1 << MD_DISK_JOURNAL)))
|
|
+ disks[disk.raid_disk * 2 + 1] = disk;
|
|
+ else if (next < max_disks * 2)
|
|
disks[next++] = disk;
|
|
}
|
|
|
|
avail = xcalloc(array.raid_disks, 1);
|
|
|
|
- for (d= 0; d < array.raid_disks; d++) {
|
|
+ for (d = 0; d < array.raid_disks; d++) {
|
|
|
|
if ((disks[d*2].state & (1<<MD_DISK_SYNC)) ||
|
|
(disks[d*2+1].state & (1<<MD_DISK_SYNC))) {
|
|
@@ -354,8 +357,8 @@ int Detail(char *dev, struct context *c)
|
|
if (c->verbose > 0) {
|
|
if (array.raid_disks)
|
|
printf(" level=%s num-devices=%d",
|
|
- str?str:"-unknown-",
|
|
- array.raid_disks );
|
|
+ str ? str : "-unknown-",
|
|
+ array.raid_disks);
|
|
else if (!inactive)
|
|
printf(" level=container num-devices=%d",
|
|
array.nr_disks);
|
|
@@ -369,8 +372,8 @@ int Detail(char *dev, struct context *c)
|
|
if (sra && sra->array.major_version < 0)
|
|
printf(" metadata=%s", sra->text_version);
|
|
else
|
|
- printf(" metadata=%d.%d",
|
|
- array.major_version, array.minor_version);
|
|
+ printf(" metadata=%d.%d", array.major_version,
|
|
+ array.minor_version);
|
|
}
|
|
|
|
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
|
|
@@ -385,7 +388,7 @@ int Detail(char *dev, struct context *c)
|
|
char *devnm;
|
|
|
|
devnm = stat2devnm(&stb);
|
|
- for (e=ms; e; e=e->next)
|
|
+ for (e = ms; e; e = e->next)
|
|
if (strcmp(e->devnm, devnm) == 0)
|
|
break;
|
|
if (!get_dev_size(fd, NULL, &larray_size))
|
|
@@ -394,14 +397,16 @@ int Detail(char *dev, struct context *c)
|
|
printf("%s:\n", dev);
|
|
|
|
if (container)
|
|
- printf(" Container : %s, member %s\n", container,
|
|
- member);
|
|
+ printf(" Container : %s, member %s\n",
|
|
+ container, member);
|
|
else {
|
|
- if (sra && sra->array.major_version < 0)
|
|
- printf(" Version : %s\n", sra->text_version);
|
|
- else
|
|
- printf(" Version : %d.%d\n",
|
|
- array.major_version, array.minor_version);
|
|
+ if (sra && sra->array.major_version < 0)
|
|
+ printf(" Version : %s\n",
|
|
+ sra->text_version);
|
|
+ else
|
|
+ printf(" Version : %d.%d\n",
|
|
+ array.major_version,
|
|
+ array.minor_version);
|
|
}
|
|
|
|
atime = array.ctime;
|
|
@@ -412,14 +417,17 @@ int Detail(char *dev, struct context *c)
|
|
if (str)
|
|
printf(" Raid Level : %s\n", str);
|
|
if (larray_size)
|
|
- printf(" Array Size : %llu%s\n", (larray_size>>10),
|
|
+ printf(" Array Size : %llu%s\n",
|
|
+ (larray_size >> 10),
|
|
human_size(larray_size));
|
|
if (array.level >= 1) {
|
|
if (sra)
|
|
array.major_version = sra->array.major_version;
|
|
if (array.major_version != 0 &&
|
|
(larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
|
|
- unsigned long long dsize = get_component_size(fd);
|
|
+ unsigned long long dsize;
|
|
+
|
|
+ dsize = get_component_size(fd);
|
|
if (dsize > 0)
|
|
printf(" Used Dev Size : %llu%s\n",
|
|
dsize/2,
|
|
@@ -429,7 +437,8 @@ int Detail(char *dev, struct context *c)
|
|
} else
|
|
printf(" Used Dev Size : %lu%s\n",
|
|
(unsigned long)array.size,
|
|
- human_size((unsigned long long)array.size<<10));
|
|
+ human_size((unsigned long long)
|
|
+ array.size << 10));
|
|
}
|
|
if (array.raid_disks)
|
|
printf(" Raid Devices : %d\n", array.raid_disks);
|
|
@@ -440,7 +449,7 @@ int Detail(char *dev, struct context *c)
|
|
printf(" Preferred Minor : %d\n", array.md_minor);
|
|
if (sra == NULL || sra->array.major_version >= 0)
|
|
printf(" Persistence : Superblock is %spersistent\n",
|
|
- array.not_persistent?"not ":"");
|
|
+ array.not_persistent ? "not " : "");
|
|
printf("\n");
|
|
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
|
|
if (ioctl(fd, GET_BITMAP_FILE, &bmf) == 0 && bmf.pathname[0]) {
|
|
@@ -465,19 +474,25 @@ int Detail(char *dev, struct context *c)
|
|
st = ", degraded";
|
|
|
|
printf(" State : %s%s%s%s%s%s \n",
|
|
- (array.state&(1<<MD_SB_CLEAN))?"clean":"active", st,
|
|
- (!e || (e->percent < 0 && e->percent != RESYNC_PENDING &&
|
|
- e->percent != RESYNC_DELAYED)) ? "" : sync_action[e->resync],
|
|
+ (array.state & (1 << MD_SB_CLEAN)) ?
|
|
+ "clean" : "active", st,
|
|
+ (!e || (e->percent < 0 &&
|
|
+ e->percent != RESYNC_PENDING &&
|
|
+ e->percent != RESYNC_DELAYED)) ?
|
|
+ "" : sync_action[e->resync],
|
|
larray_size ? "": ", Not Started",
|
|
- (e && e->percent == RESYNC_DELAYED) ? " (DELAYED)": "",
|
|
- (e && e->percent == RESYNC_PENDING) ? " (PENDING)": "");
|
|
+ (e && e->percent == RESYNC_DELAYED) ?
|
|
+ " (DELAYED)": "",
|
|
+ (e && e->percent == RESYNC_PENDING) ?
|
|
+ " (PENDING)": "");
|
|
} else if (inactive) {
|
|
printf(" State : inactive\n");
|
|
}
|
|
if (array.raid_disks)
|
|
printf(" Active Devices : %d\n", array.active_disks);
|
|
if (array.working_disks > 0)
|
|
- printf(" Working Devices : %d\n", array.working_disks);
|
|
+ printf(" Working Devices : %d\n",
|
|
+ array.working_disks);
|
|
if (array.raid_disks) {
|
|
printf(" Failed Devices : %d\n", array.failed_disks);
|
|
printf(" Spare Devices : %d\n", array.spare_disks);
|
|
@@ -485,11 +500,13 @@ int Detail(char *dev, struct context *c)
|
|
printf("\n");
|
|
if (array.level == 5) {
|
|
str = map_num(r5layout, array.layout);
|
|
- printf(" Layout : %s\n", str?str:"-unknown-");
|
|
+ printf(" Layout : %s\n",
|
|
+ str ? str : "-unknown-");
|
|
}
|
|
if (array.level == 6) {
|
|
str = map_num(r6layout, array.layout);
|
|
- printf(" Layout : %s\n", str?str:"-unknown-");
|
|
+ printf(" Layout : %s\n",
|
|
+ str ? str : "-unknown-");
|
|
}
|
|
if (array.level == 10) {
|
|
printf(" Layout :");
|
|
@@ -510,12 +527,14 @@ int Detail(char *dev, struct context *c)
|
|
printf(" Rounding : %dK\n\n",
|
|
array.chunk_size/1024);
|
|
break;
|
|
- default: break;
|
|
+ default:
|
|
+ break;
|
|
}
|
|
|
|
if (array.raid_disks) {
|
|
- struct mdinfo *mdi = sysfs_read(fd, NULL,
|
|
- GET_CONSISTENCY_POLICY);
|
|
+ struct mdinfo *mdi;
|
|
+
|
|
+ mdi = sysfs_read(fd, NULL, GET_CONSISTENCY_POLICY);
|
|
if (mdi) {
|
|
char *policy = map_num(consistency_policies,
|
|
mdi->consistency_policy);
|
|
@@ -528,8 +547,7 @@ int Detail(char *dev, struct context *c)
|
|
|
|
if (e && e->percent >= 0) {
|
|
static char *sync_action[] = {
|
|
- "Rebuild", "Resync",
|
|
- "Reshape", "Check"};
|
|
+ "Rebuild", "Resync", "Reshape", "Check"};
|
|
printf(" %7s Status : %d%% complete\n",
|
|
sync_action[e->resync], e->percent);
|
|
}
|
|
@@ -539,8 +557,9 @@ int Detail(char *dev, struct context *c)
|
|
#if 0
|
|
This is pretty boring
|
|
printf(" Reshape pos'n : %llu%s\n",
|
|
- (unsigned long long) info->reshape_progress<<9,
|
|
- human_size((unsigned long long)info->reshape_progress<<9));
|
|
+ (unsigned long long) info->reshape_progress << 9,
|
|
+ human_size((unsigned long long)
|
|
+ info->reshape_progress << 9));
|
|
#endif
|
|
if (info->delta_disks != 0)
|
|
printf(" Delta Devices : %d, (%d->%d)\n",
|
|
@@ -549,25 +568,29 @@ This is pretty boring
|
|
array.raid_disks);
|
|
if (info->new_level != array.level) {
|
|
str = map_num(pers, info->new_level);
|
|
- printf(" New Level : %s\n", str?str:"-unknown-");
|
|
+ printf(" New Level : %s\n",
|
|
+ str ? str : "-unknown-");
|
|
}
|
|
if (info->new_level != array.level ||
|
|
info->new_layout != array.layout) {
|
|
if (info->new_level == 5) {
|
|
- str = map_num(r5layout, info->new_layout);
|
|
+ str = map_num(r5layout,
|
|
+ info->new_layout);
|
|
printf(" New Layout : %s\n",
|
|
- str?str:"-unknown-");
|
|
+ str ? str : "-unknown-");
|
|
}
|
|
if (info->new_level == 6) {
|
|
- str = map_num(r6layout, info->new_layout);
|
|
+ str = map_num(r6layout,
|
|
+ info->new_layout);
|
|
printf(" New Layout : %s\n",
|
|
- str?str:"-unknown-");
|
|
+ str ? str : "-unknown-");
|
|
}
|
|
if (info->new_level == 10) {
|
|
printf(" New Layout : near=%d, %s=%d\n",
|
|
- info->new_layout&255,
|
|
- (info->new_layout&0x10000)?"offset":"far",
|
|
- (info->new_layout>>8)&255);
|
|
+ info->new_layout & 255,
|
|
+ (info->new_layout & 0x10000) ?
|
|
+ "offset" : "far",
|
|
+ (info->new_layout >> 8) & 255);
|
|
}
|
|
}
|
|
if (info->new_chunk != array.chunk_size)
|
|
@@ -579,8 +602,10 @@ This is pretty boring
|
|
if (st && st->sb)
|
|
st->ss->detail_super(st, c->homehost);
|
|
|
|
- if (array.raid_disks == 0 && sra && sra->array.major_version == -1
|
|
- && sra->array.minor_version == -2 && sra->text_version[0] != '/') {
|
|
+ if (array.raid_disks == 0 && sra &&
|
|
+ sra->array.major_version == -1 &&
|
|
+ sra->array.minor_version == -2 &&
|
|
+ sra->text_version[0] != '/') {
|
|
/* This looks like a container. Find any active arrays
|
|
* That claim to be a member.
|
|
*/
|
|
@@ -596,19 +621,21 @@ This is pretty boring
|
|
dev_t devid;
|
|
if (de->d_name[0] == '.')
|
|
continue;
|
|
- sprintf(path, "/sys/block/%s/md/metadata_version",
|
|
+ sprintf(path,
|
|
+ "/sys/block/%s/md/metadata_version",
|
|
de->d_name);
|
|
if (load_sys(path, vbuf, sizeof(vbuf)) < 0)
|
|
continue;
|
|
- if (strncmp(vbuf, "external:", 9) != 0 ||
|
|
- !is_subarray(vbuf+9) ||
|
|
- strncmp(vbuf+10, sra->sys_name, nlen) != 0 ||
|
|
- vbuf[10+nlen] != '/')
|
|
+ if (strncmp(vbuf, "external:", 9) ||
|
|
+ !is_subarray(vbuf + 9) ||
|
|
+ strncmp(vbuf + 10, sra->sys_name, nlen) ||
|
|
+ vbuf[10 + nlen] != '/')
|
|
continue;
|
|
devid = devnm2devid(de->d_name);
|
|
- printf(" %s", map_dev_preferred(
|
|
- major(devid),
|
|
- minor(devid), 1, c->prefer));
|
|
+ printf(" %s",
|
|
+ map_dev_preferred(major(devid),
|
|
+ minor(devid), 1,
|
|
+ c->prefer));
|
|
}
|
|
if (dir)
|
|
closedir(dir);
|
|
@@ -622,24 +649,23 @@ This is pretty boring
|
|
}
|
|
free(info);
|
|
|
|
- for (d= 0; d < max_disks * 2; d++) {
|
|
+ for (d = 0; d < max_disks * 2; d++) {
|
|
char *dv;
|
|
mdu_disk_info_t disk = disks[d];
|
|
|
|
- if (d >= array.raid_disks*2 &&
|
|
- disk.major == 0 &&
|
|
- disk.minor == 0)
|
|
+ if (d >= array.raid_disks * 2 &&
|
|
+ disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
- if ((d & 1) &&
|
|
- disk.major == 0 &&
|
|
- disk.minor == 0)
|
|
+ if ((d & 1) && disk.major == 0 && disk.minor == 0)
|
|
continue;
|
|
if (!c->brief) {
|
|
- if (d == array.raid_disks*2) printf("\n");
|
|
+ if (d == array.raid_disks*2)
|
|
+ printf("\n");
|
|
if (disk.number < 0 && disk.raid_disk < 0)
|
|
printf(" - %5d %5d - ",
|
|
disk.major, disk.minor);
|
|
- else if (disk.raid_disk < 0 || disk.state & (1<<MD_DISK_JOURNAL))
|
|
+ else if (disk.raid_disk < 0 ||
|
|
+ disk.state & (1 << MD_DISK_JOURNAL))
|
|
printf(" %5d %5d %5d - ",
|
|
disk.number, disk.major, disk.minor);
|
|
else if (disk.number < 0)
|
|
@@ -647,34 +673,44 @@ This is pretty boring
|
|
disk.major, disk.minor, disk.raid_disk);
|
|
else
|
|
printf(" %5d %5d %5d %5d ",
|
|
- disk.number, disk.major, disk.minor, disk.raid_disk);
|
|
+ disk.number, disk.major, disk.minor,
|
|
+ disk.raid_disk);
|
|
}
|
|
if (!c->brief && array.raid_disks) {
|
|
-
|
|
- if (disk.state & (1<<MD_DISK_FAULTY)) {
|
|
+ if (disk.state & (1 << MD_DISK_FAULTY)) {
|
|
printf(" faulty");
|
|
if (disk.raid_disk < array.raid_disks &&
|
|
disk.raid_disk >= 0)
|
|
failed++;
|
|
}
|
|
- if (disk.state & (1<<MD_DISK_ACTIVE)) printf(" active");
|
|
- if (disk.state & (1<<MD_DISK_SYNC)) {
|
|
+ if (disk.state & (1 << MD_DISK_ACTIVE))
|
|
+ printf(" active");
|
|
+ if (disk.state & (1 << MD_DISK_SYNC)) {
|
|
printf(" sync");
|
|
- if (array.level == 10 && (array.layout & ~0x1FFFF) == 0) {
|
|
+ if (array.level == 10 &&
|
|
+ (array.layout & ~0x1FFFF) == 0) {
|
|
int nc = array.layout & 0xff;
|
|
int fc = (array.layout >> 8) & 0xff;
|
|
int copies = nc*fc;
|
|
- if (fc == 1 && array.raid_disks % copies == 0 && copies <= 26) {
|
|
- /* We can divide the devices into 'sets' */
|
|
- int set = disk.raid_disk % copies;
|
|
+ if (fc == 1 &&
|
|
+ array.raid_disks % copies == 0 &&
|
|
+ copies <= 26) {
|
|
+ /* We can divide the devices
|
|
+ into 'sets' */
|
|
+ int set;
|
|
+ set = disk.raid_disk % copies;
|
|
printf(" set-%c", set + 'A');
|
|
}
|
|
}
|
|
}
|
|
- if (disk.state & (1<<MD_DISK_REMOVED)) printf(" removed");
|
|
- if (disk.state & (1<<MD_DISK_WRITEMOSTLY)) printf(" writemostly");
|
|
- if (disk.state & (1<<MD_DISK_FAILFAST)) printf(" failfast");
|
|
- if (disk.state & (1<<MD_DISK_JOURNAL)) printf(" journal");
|
|
+ if (disk.state & (1 << MD_DISK_REMOVED))
|
|
+ printf(" removed");
|
|
+ if (disk.state & (1 << MD_DISK_WRITEMOSTLY))
|
|
+ printf(" writemostly");
|
|
+ if (disk.state & (1 << MD_DISK_FAILFAST))
|
|
+ printf(" failfast");
|
|
+ if (disk.state & (1 << MD_DISK_JOURNAL))
|
|
+ printf(" journal");
|
|
if ((disk.state &
|
|
((1<<MD_DISK_ACTIVE)|(1<<MD_DISK_SYNC)
|
|
|(1<<MD_DISK_REMOVED)|(1<<MD_DISK_FAULTY)|(1<<MD_DISK_JOURNAL)))
|
|
@@ -685,19 +721,21 @@ This is pretty boring
|
|
printf(" rebuilding");
|
|
}
|
|
}
|
|
- if (disk.state == 0) spares++;
|
|
- dv=map_dev_preferred(disk.major, disk.minor, 0, c->prefer);
|
|
+ if (disk.state == 0)
|
|
+ spares++;
|
|
+ dv = map_dev_preferred(disk.major, disk.minor, 0, c->prefer);
|
|
if (dv != NULL) {
|
|
if (c->brief)
|
|
n_devices = add_device(dv, &devices,
|
|
- &max_devices,
|
|
- n_devices);
|
|
+ &max_devices, n_devices);
|
|
else
|
|
printf(" %s", dv);
|
|
}
|
|
- if (!c->brief) printf("\n");
|
|
+ if (!c->brief)
|
|
+ printf("\n");
|
|
}
|
|
- if (spares && c->brief && array.raid_disks) printf(" spares=%d", spares);
|
|
+ if (spares && c->brief && array.raid_disks)
|
|
+ printf(" spares=%d", spares);
|
|
if (c->brief && st && st->sb)
|
|
st->ss->brief_detail_super(st);
|
|
if (st)
|
|
@@ -712,8 +750,7 @@ This is pretty boring
|
|
if (c->brief)
|
|
printf("\n");
|
|
if (c->test &&
|
|
- !enough(array.level, array.raid_disks, array.layout,
|
|
- 1, avail))
|
|
+ !enough(array.level, array.raid_disks, array.layout, 1, avail))
|
|
rv = 2;
|
|
|
|
free(disks);
|
|
--
|
|
2.13.6
|
|
|