forked from pool/s390-tools
6a6c0cb679
*** v2.34.0 * Changes of existing tools: - ap_tools/ap-check: Add support for vfio-ap dynamic configuration - dbginfo.sh: Update/Add additional DASD data collection - dumpconf: Add new parameter 'SCP_DATA' for SCSI/NVMe/ECKD dump devices - libutil: Make formatted meta-data configurable - s390-tools: Replace 'which' with built-in 'command -v' - zdump/dfi_elf: Support core dumps of vr-kernels * Bug Fixes: - chzdev: Fix warning about failed ATTR writes by udev - rust/pv: Try again if first CRL-URI is invalid - rust/pvattest: Add short option for --arpk - zdump: Fix 'zgetdump -i' ioctl error on s390 formatted dump file *** v2.33.1 * Bug Fixes: - s390-tools: Fix formatting and typos in README.md - s390-tools: Fix release string *** v2.33.0 * Add new tools / libraries: - chpstat: New tool for displaying channel path statistics - libutil: Add output format helpers(util_fmt: JSON, JSON-SEQ, CSV, text pairs) * Changes of existing tools / libraries: - chzdev: Add --is-owner to identify files created by zdev - dasdfmt: Change default mode to always use full-format (Note: affects ESE DASD) - libap: Significantly reduce delay time between file lock retries - pvattest: Rewrite from C to Rust - pvattest: Support additional data & user-data - rust/pv: Support for Attestation * Bug Fixes: - chreipl: Improve disk type detection when running under QEMU - dbginfo.sh: Use POSIX option with uname - s390-tools: Fix missing hyphen escapes in the man page for many tools - zipl/src: Fix bugs in disk_get_info() reproducible in corner cases *** v2.32.0 * Changes of existing tools: - cpumf/lscpumf: add support for machine type 3932 - genprotimg, pvattest, and pvsecret accept IBM signing key with Armonk as subject locality - zdump/zipl: Support for List-Directed dump from ECKD DASD - zkey: Detect FIPS mode and generate PBKDF for luksFormat according to it * Bug Fixes: - dbginfo.sh: dash compatible copy sequence - rust/pv_core: Fix UvDeviceInfo::get() method - zipl/src: Fix leak of files if run with a broken configuration - zkey: Fix convert command to accept only keys of type CCA-AESDATA * Revendored vendor.tar.gz * Removed obsolete patches - s390-tools-sles15sp5-01-rust-pv-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-02-genprotimg-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-03-libpv-support-Armonk-in-IBM-signing-key-subject.patch - s390-tools-sles15sp6-04-pvattest-Fix-root-ca-parsing.patch - s390-tools-sles15sp6-genprotimg-makefile.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=219
177 lines
5.0 KiB
Diff
177 lines
5.0 KiB
Diff
From a61154fd93122f5a0f2b74f21c3ac29eb437f150 Mon Sep 17 00:00:00 2001
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
Date: Fri, 6 Oct 2017 09:39:36 +0200
|
|
Subject: [PATCH] dasdfmt: Format devices in parallel
|
|
|
|
Allow dasdfmt to run in parallel when several devices are specified.
|
|
|
|
Signed-off-by: Hannes Reinecke <hare@suse.com>
|
|
---
|
|
dasdfmt/dasdfmt.8 | 16 +++++++++++++-
|
|
dasdfmt/dasdfmt.c | 58 ++++++++++++++++++++++++++++++++++++++++++------------
|
|
2 files changed, 60 insertions(+), 14 deletions(-)
|
|
|
|
--- a/dasdfmt/dasdfmt.8
|
|
+++ b/dasdfmt/dasdfmt.8
|
|
@@ -7,7 +7,7 @@
|
|
dasdfmt \- formatting of DASD (ECKD) disk drives.
|
|
|
|
.SH SYNOPSIS
|
|
-\fBdasdfmt\fR [\-h] [\-t] [\-v] [\-y] [\-p] [\-P] [\-m \fIstep\fR]
|
|
+\fBdasdfmt\fR [\-h] [\-t] [\-v] [\-y] [\-p] [\-Q] [\-P] [\-m \fIstep\fR]
|
|
.br
|
|
[\-r \fIcylinder\fR] [\-b \fIblksize\fR] [\-l \fIvolser\fR] [\-d \fIlayout\fR]
|
|
.br
|
|
@@ -95,7 +95,7 @@
|
|
running in background or redirecting the output to a file.
|
|
|
|
.TP
|
|
-\fB\-P\fR or \fB\-\-percentage\fR
|
|
+\fB\-Q\fR or \fB\-\-percentage\fR
|
|
Print one line for each formatted cylinder showing the number of the
|
|
cylinder and percentage of formatting process.
|
|
Intended to be used by higher level interfaces.
|
|
@@ -164,6 +164,18 @@
|
|
|
|
.TP
|
|
\fB\-l\fR \fIvolser\fR or \fB\-\-label\fR=\fIvolser\fR
|
|
+\fB-P\fR \fInumdisks\fR or \fB--max_parallel\fR=\fInumdisks\fR
|
|
+Specify the number of disks to be formatted in parallel.
|
|
+\fInumdisks\fR specifies the number of formatting processed,
|
|
+independent on the overall number of disks to be formatted.
|
|
+The maximum value for \fInumdisks\fR is 512. Default is 1.
|
|
+.br
|
|
+Using this option can decrease overall processing time when formatting
|
|
+several disks. Please note that the I/O throughput will dramatically
|
|
+increase when using this option. Use with care.
|
|
+.br
|
|
+
|
|
+.TP
|
|
Specify the volume serial number or volume identifier to be written
|
|
to disk after formatting. If no label is specified, a sensible default
|
|
is used. \fIvolser\fR is interpreted as ASCII string and is automatically
|
|
--- a/dasdfmt/dasdfmt.c
|
|
+++ b/dasdfmt/dasdfmt.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <sys/sysmacros.h>
|
|
#include <sys/time.h>
|
|
#include <sys/utsname.h>
|
|
+#include <sys/wait.h>
|
|
|
|
#include "lib/dasd_base.h"
|
|
#include "lib/dasd_sys.h"
|
|
@@ -81,6 +82,7 @@
|
|
int mode_specified;
|
|
int ese;
|
|
int no_discard;
|
|
+ int procnum;
|
|
} g = {
|
|
.dasd_info = { 0 },
|
|
};
|
|
@@ -105,6 +107,11 @@
|
|
.desc = "Perform complete format check on device",
|
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
|
},
|
|
+ {
|
|
+ .option = { "max_parallel", required_argument, NULL, 'P' },
|
|
+ .desc = "Format devices in parallel",
|
|
+ .flags = UTIL_OPT_FLAG_NOLONG,
|
|
+ },
|
|
UTIL_OPT_SECTION("FORMAT OPTIONS"),
|
|
{
|
|
.option = { "blocksize", required_argument, NULL, 'b' },
|
|
@@ -162,7 +169,7 @@
|
|
.desc = "Show a progressbar",
|
|
},
|
|
{
|
|
- .option = { "percentage", no_argument, NULL, 'P' },
|
|
+ .option = { "percentage", no_argument, NULL, 'Q' },
|
|
.desc = "Show progress in percent",
|
|
},
|
|
UTIL_OPT_SECTION("MISC"),
|
|
@@ -311,7 +318,7 @@
|
|
}
|
|
|
|
if (g.print_hashmarks && (cyl / g.hashstep - hashcount) != 0) {
|
|
- printf("#");
|
|
+ printf("%d|", g.procnum);
|
|
fflush(stdout);
|
|
hashcount++;
|
|
}
|
|
@@ -1560,7 +1567,11 @@
|
|
char *reqsize_param_str = NULL;
|
|
char *hashstep_str = NULL;
|
|
|
|
- int rc, numdev = 0, i;
|
|
+ int rc, numdev = 0, numproc = 0, status;
|
|
+ int max_parallel =1 ;
|
|
+ int running = 0;
|
|
+ int chpid;
|
|
+ int tmp;
|
|
|
|
/* Establish a handler for interrupt signals. */
|
|
signal(SIGTERM, program_interrupt_signal);
|
|
@@ -1623,7 +1634,7 @@
|
|
g.print_hashmarks = 1;
|
|
}
|
|
break;
|
|
- case 'P':
|
|
+ case 'Q':
|
|
if (!(g.print_hashmarks || g.print_progressbar))
|
|
g.print_percentage = 1;
|
|
break;
|
|
@@ -1682,6 +1693,9 @@
|
|
case OPT_NODISCARD:
|
|
g.no_discard = 1;
|
|
break;
|
|
+ case 'P':
|
|
+ max_parallel = atoi(optarg);
|
|
+ break;
|
|
case OPT_CHECK:
|
|
g.check = 1;
|
|
break;
|
|
@@ -1733,15 +1747,35 @@
|
|
if (numdev > 1 && g.labelspec)
|
|
error("Specifying a volser to be written doesn't make sense when formatting multiple DASD volumes.");
|
|
|
|
- for (i = 0; i < numdev; i++)
|
|
- {
|
|
- strncpy(g.dev_path, g.dev_path_array[i], strlen(g.dev_path_array[i])+1);
|
|
- strncpy(g.dev_node, g.dev_node_array[i], strlen(g.dev_node_array[i])+1);
|
|
- process_dasd(&vlabel, format_params);
|
|
+ for (numproc = 0; numproc < numdev; numproc++) {
|
|
+ chpid = fork();
|
|
+ if (chpid == -1 )
|
|
+ ERRMSG_EXIT(EXIT_FAILURE,
|
|
+ "%s: Unable to create child process: %s\n",
|
|
+ prog_name, strerror(errno));
|
|
+ if (!chpid) {
|
|
+ g.procnum = numproc;
|
|
+ strncpy(g.dev_path, g.dev_path_array[numproc], strlen(g.dev_path_array[numproc])+1);
|
|
+ strncpy(g.dev_node, g.dev_node_array[numproc], strlen(g.dev_node_array[numproc])+1);
|
|
+ process_dasd(&vlabel, format_params);
|
|
+
|
|
+ free(g.dev_path);
|
|
+ free(g.dev_node);
|
|
+ exit(0);
|
|
+ } else {
|
|
+ running++;
|
|
+ if (running >= max_parallel) {
|
|
+ if (wait(&tmp) > 0 && WEXITSTATUS(tmp))
|
|
+ rc = WEXITSTATUS(tmp);
|
|
+ running--;
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
- free(g.dev_path);
|
|
- free(g.dev_node);
|
|
+ /* wait until all formatting children have finished */
|
|
+ while(wait(&status) > 0)
|
|
+ if (WEXITSTATUS(status))
|
|
+ rc = WEXITSTATUS(status);
|
|
|
|
- return 0;
|
|
+ return rc;
|
|
}
|