2e35d7583b
- Update for latest mdadm-4.1+ patches, this is required by jsc#SLE-10078 and jsc#SLE-9348. Mostly the purpose is for latest Intel IMSM raid support. The following patches also include previous patches with new re-ordered prefix numbers. - Makefile: install mdadm_env.sh to /usr/lib/mdadm (bsc#1111960) 0000-Makefile-install-mdadm_env.sh-to-usr-lib-mdadm.patch - Assemble: keep MD_DISK_FAILFAST and MD_DISK_WRITEMOSTLY flag (jsc#SLE-10078, jsc#SLE-9348) 0001-Assemble-keep-MD_DISK_FAILFAST-and-MD_DISK_WRITEMOST.patch - Document PART-POLICY lines (jsc#SLE-10078, jsc#SLE-9348) 0002-Document-PART-POLICY-lines.patc - policy: support devices with multiple paths. (jsc#SLE-10078, jsc#SLE-9348) 0003-policy-support-devices-with-multiple-paths.patch - mdcheck: add systemd unit files to run mdcheck. (bsc#1115407) 0004-mdcheck-add-systemd-unit-files-to-run-mdcheck.patch - Monitor: add system timer to run --oneshot periodically (bsc#1115407) 0005-Monitor-add-system-timer-to-run-oneshot-periodically.patch - imsm: update metadata correctly while raid10 double (jsc#SLE-10078, jsc#SLE-9348) 0006-imsm-update-metadata-correctly-while-raid10-double-d.patch - Assemble: mask FAILFAST and WRITEMOSTLY flags when finding (jsc#SLE-10078, jsc#SLE-9348) 0007-Assemble-mask-FAILFAST-and-WRITEMOSTLY-flags-when-fi.patch - Grow: avoid overflow in compute_backup_blocks() (jsc#SLE-10078, jsc#SLE-9348) 0008-Grow-avoid-overflow-in-compute_backup_blocks.patch - Grow: report correct new chunk size. (jsc#SLE-10078, jsc#SLE-9348) 0009-Grow-report-correct-new-chunk-size.patch OBS-URL: https://build.opensuse.org/request/show/781064 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=181
198 lines
7.2 KiB
Diff
198 lines
7.2 KiB
Diff
From 42e641abeb312a91b841f1b1ea73661e4bd5a31c Mon Sep 17 00:00:00 2001
|
|
From: Kinga Tanska <kinga.tanska@intel.com>
|
|
Date: Tue, 21 Jan 2020 10:38:52 +0100
|
|
Subject: [PATCH] Add support for Tebibytes
|
|
Git-commit: 42e641abeb312a91b841f1b1ea73661e4bd5a31c
|
|
Patch-mainline: mdadm-4.1+
|
|
References: jsc#SLE-10078, jsc#SLE-9348
|
|
|
|
Adding support for Tebibytes enables display size of
|
|
volumes in Tebibytes and Terabytes when they are
|
|
bigger than 2048 GiB (or GB).
|
|
|
|
Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
|
|
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
Signed-off-by: Coly Li <colyli@suse.de>
|
|
|
|
---
|
|
mdadm.8.in | 20 ++++++++++----------
|
|
util.c | 47 +++++++++++++++++++++++++++++++++--------------
|
|
2 files changed, 43 insertions(+), 24 deletions(-)
|
|
|
|
diff --git a/mdadm.8.in b/mdadm.8.in
|
|
index ca02a33..5d00faf 100644
|
|
--- a/mdadm.8.in
|
|
+++ b/mdadm.8.in
|
|
@@ -467,8 +467,8 @@ If this is not specified
|
|
size, though if there is a variance among the drives of greater than 1%, a warning is
|
|
issued.
|
|
|
|
-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or
|
|
-Gigabytes respectively.
|
|
+A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes,
|
|
+Megabytes, Gigabytes or Terabytes respectively.
|
|
|
|
Sometimes a replacement drive can be a little smaller than the
|
|
original drives though this should be minimised by IDEMA standards.
|
|
@@ -532,8 +532,8 @@ problems the array can be made bigger again with no loss with another
|
|
.B "\-\-grow \-\-array\-size="
|
|
command.
|
|
|
|
-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or
|
|
-Gigabytes respectively.
|
|
+A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes,
|
|
+Megabytes, Gigabytes or Terabytes respectively.
|
|
A value of
|
|
.B max
|
|
restores the apparent size of the array to be whatever the real
|
|
@@ -551,8 +551,8 @@ This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10.
|
|
RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power
|
|
of 2. In any case it must be a multiple of 4KB.
|
|
|
|
-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or
|
|
-Gigabytes respectively.
|
|
+A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes,
|
|
+Megabytes, Gigabytes or Terabytes respectively.
|
|
|
|
.TP
|
|
.BR \-\-rounding=
|
|
@@ -767,8 +767,8 @@ When using an
|
|
bitmap, the chunksize defaults to 64Meg, or larger if necessary to
|
|
fit the bitmap into the available space.
|
|
|
|
-A suffix of 'K', 'M' or 'G' can be given to indicate Kilobytes, Megabytes or
|
|
-Gigabytes respectively.
|
|
+A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes,
|
|
+Megabytes, Gigabytes or Terabytes respectively.
|
|
|
|
.TP
|
|
.BR \-W ", " \-\-write\-mostly
|
|
@@ -857,8 +857,8 @@ an array which was originally created using a different version of
|
|
which computed a different offset.
|
|
|
|
Setting the offset explicitly over-rides the default. The value given
|
|
-is in Kilobytes unless a suffix of 'K', 'M' or 'G' is used to explicitly
|
|
-indicate Kilobytes, Megabytes or Gigabytes respectively.
|
|
+is in Kilobytes unless a suffix of 'K', 'M', 'G' or 'T' is used to explicitly
|
|
+indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively.
|
|
|
|
Since Linux 3.4,
|
|
.B \-\-data\-offset
|
|
diff --git a/util.c b/util.c
|
|
index 64dd409..07f9dc3 100644
|
|
--- a/util.c
|
|
+++ b/util.c
|
|
@@ -389,7 +389,7 @@ int mdadm_version(char *version)
|
|
unsigned long long parse_size(char *size)
|
|
{
|
|
/* parse 'size' which should be a number optionally
|
|
- * followed by 'K', 'M', or 'G'.
|
|
+ * followed by 'K', 'M'. 'G' or 'T'.
|
|
* Without a suffix, K is assumed.
|
|
* Number returned is in sectors (half-K)
|
|
* INVALID_SECTORS returned on error.
|
|
@@ -411,6 +411,10 @@ unsigned long long parse_size(char *size)
|
|
c++;
|
|
s *= 1024 * 1024 * 2;
|
|
break;
|
|
+ case 'T':
|
|
+ c++;
|
|
+ s *= 1024 * 1024 * 1024 * 2LL;
|
|
+ break;
|
|
case 's': /* sectors */
|
|
c++;
|
|
break;
|
|
@@ -893,13 +897,14 @@ char *human_size(long long bytes)
|
|
{
|
|
static char buf[47];
|
|
|
|
- /* We convert bytes to either centi-M{ega,ibi}bytes or
|
|
- * centi-G{igi,ibi}bytes, with appropriate rounding,
|
|
- * and then print 1/100th of those as a decimal.
|
|
+ /* We convert bytes to either centi-M{ega,ibi}bytes,
|
|
+ * centi-G{igi,ibi}bytes or centi-T{era,ebi}bytes
|
|
+ * with appropriate rounding, and then print
|
|
+ * 1/100th of those as a decimal.
|
|
* We allow upto 2048Megabytes before converting to
|
|
- * gigabytes, as that shows more precision and isn't
|
|
+ * gigabytes and 2048Gigabytes before converting to
|
|
+ * terabytes, as that shows more precision and isn't
|
|
* too large a number.
|
|
- * Terabytes are not yet handled.
|
|
*/
|
|
|
|
if (bytes < 5000*1024)
|
|
@@ -909,11 +914,16 @@ char *human_size(long long bytes)
|
|
long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
|
|
snprintf(buf, sizeof(buf), " (%ld.%02ld MiB %ld.%02ld MB)",
|
|
cMiB/100, cMiB % 100, cMB/100, cMB % 100);
|
|
- } else {
|
|
+ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) {
|
|
long cGiB = (bytes * 200LL / (1LL<<30) +1) / 2;
|
|
long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
|
|
snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",
|
|
cGiB/100, cGiB % 100, cGB/100, cGB % 100);
|
|
+ } else {
|
|
+ long cTiB = (bytes * 200LL / (1LL<<40) + 1) / 2;
|
|
+ long cTB = (bytes / (1000000000000LL / 200LL) + 1) / 2;
|
|
+ snprintf(buf, sizeof(buf), " (%ld.%02ld TiB %ld.%02ld TB)",
|
|
+ cTiB/100, cTiB % 100, cTB/100, cTB % 100);
|
|
}
|
|
return buf;
|
|
}
|
|
@@ -922,13 +932,14 @@ char *human_size_brief(long long bytes, int prefix)
|
|
{
|
|
static char buf[30];
|
|
|
|
- /* We convert bytes to either centi-M{ega,ibi}bytes or
|
|
- * centi-G{igi,ibi}bytes, with appropriate rounding,
|
|
- * and then print 1/100th of those as a decimal.
|
|
+ /* We convert bytes to either centi-M{ega,ibi}bytes,
|
|
+ * centi-G{igi,ibi}bytes or centi-T{era,ebi}bytes
|
|
+ * with appropriate rounding, and then print
|
|
+ * 1/100th of those as a decimal.
|
|
* We allow upto 2048Megabytes before converting to
|
|
- * gigabytes, as that shows more precision and isn't
|
|
+ * gigabytes and 2048Gigabytes before converting to
|
|
+ * terabytes, as that shows more precision and isn't
|
|
* too large a number.
|
|
- * Terabytes are not yet handled.
|
|
*
|
|
* If prefix == IEC, we mean prefixes like kibi,mebi,gibi etc.
|
|
* If prefix == JEDEC, we mean prefixes like kilo,mega,giga etc.
|
|
@@ -941,10 +952,14 @@ char *human_size_brief(long long bytes, int prefix)
|
|
long cMiB = (bytes * 200LL / (1LL<<20) +1) /2;
|
|
snprintf(buf, sizeof(buf), "%ld.%02ldMiB",
|
|
cMiB/100, cMiB % 100);
|
|
- } else {
|
|
+ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) {
|
|
long cGiB = (bytes * 200LL / (1LL<<30) +1) /2;
|
|
snprintf(buf, sizeof(buf), "%ld.%02ldGiB",
|
|
cGiB/100, cGiB % 100);
|
|
+ } else {
|
|
+ long cTiB = (bytes * 200LL / (1LL<<40) + 1) / 2;
|
|
+ snprintf(buf, sizeof(buf), "%ld.%02ldTiB",
|
|
+ cTiB/100, cTiB % 100);
|
|
}
|
|
}
|
|
else if (prefix == JEDEC) {
|
|
@@ -952,10 +967,14 @@ char *human_size_brief(long long bytes, int prefix)
|
|
long cMB = (bytes / ( 1000000LL / 200LL ) +1) /2;
|
|
snprintf(buf, sizeof(buf), "%ld.%02ldMB",
|
|
cMB/100, cMB % 100);
|
|
- } else {
|
|
+ } else if (bytes < 2*1024LL*1024LL*1024LL*1024LL) {
|
|
long cGB = (bytes / (1000000000LL/200LL ) +1) /2;
|
|
snprintf(buf, sizeof(buf), "%ld.%02ldGB",
|
|
cGB/100, cGB % 100);
|
|
+ } else {
|
|
+ long cTB = (bytes / (1000000000000LL / 200LL) + 1) / 2;
|
|
+ snprintf(buf, sizeof(buf), "%ld.%02ldTB",
|
|
+ cTB/100, cTB % 100);
|
|
}
|
|
}
|
|
else
|
|
--
|
|
2.25.0
|
|
|