File s390-tools-sles15sp6-dasdfmt-Change-mode-default.patch of Package s390-tools.40387
From 998b61e5f3c9285cc84759a4347102d2ee6a0ff6 Mon Sep 17 00:00:00 2001
From: Eduard Shishkin <edward6@linux.ibm.com>
Date: Mon, 19 Feb 2024 17:25:04 +0100
Subject: [PATCH] dasdfmt: Change mode default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When formatting an ESE (thin-provisioned) ECKD DASD, dasdfmt(8)
defaults to the quick-format mode instead of full-format for normal
DASDs. This results in a significant performance impact during first
sequential write to each track, which may be unexpected for users.
To address this, change the default for dasdfmt to always use
full-format mode. Customers that require thin provisioning(*) still
override the default by specifying quick format explicitly using the
"-M" option.
Get rid of the related fallbacks; In case of unsuccessful space
release always fail. The customers that still require quick format can
proceed by specifying "--no-discard" option.
(*) Thin provisioning: while providing a large amount of logical
space, zero amount of actual space is provisioned and then
allocated on an on-demand basis.
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
---
dasdfmt/dasdfmt.8 | 18 +++++++++---------
dasdfmt/dasdfmt.c | 25 ++++++-------------------
2 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/dasdfmt/dasdfmt.8 b/dasdfmt/dasdfmt.8
index e41f289c..eb004756 100644
--- a/dasdfmt/dasdfmt.8
+++ b/dasdfmt/dasdfmt.8
@@ -118,16 +118,16 @@ Specify the \fImode\fR to be used to format the device. Valid modes are:
.IP full
Format the entire disk with the specified blocksize. (default)
.IP quick
-Format the first two tracks and write label and partition information. Use this
-option only if you are sure that the target DASD already contains a regular
-format with the specified blocksize. A blocksize can optionally be specified
-using \fB-b\fR (\fB--blocksize\fR).
+Format the first two tracks and write label and partition information.
+.br
+Use this option for DASD ESE volumes to take the benefits of thin provisioning.
+In this case, a full space release precedes the formatting step. If this space
+release fails, then the formatting also fails. Specify the \fB--no-discard\fR
+option to omit the space release.
.br
-For thin-provisioned DASD ESE volumes, quick is the default mode. A full space
-release then precedes the formatting step. If this space release fails, dasdfmt
-falls back to a full-format mode. Formatting stops if the space release fails
-and quick mode was specified explicitly using \fB-M\fR. Specify the
-\fB--no-discard\fR option to omit the space release.
+For non-ESE volumes use this option only if you are sure that the target DASD
+already contains a regular format with the specified blocksize. A blocksize can
+optionally be specified using \fB-b\fR (\fB--blocksize\fR).
.IP expand
Format all unformatted tracks at the end of the target DASD. This mode assumes
diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c
index 2065e12e..a49e41c0 100644
--- a/dasdfmt/dasdfmt.c
+++ b/dasdfmt/dasdfmt.c
@@ -1230,7 +1230,7 @@ static void dasdfmt_find_start(unsigned int cylinders, unsigned int heads,
format_params->start_unit = first;
}
-static int dasdfmt_release_space(void)
+static void dasdfmt_release_space(void)
{
format_data_t r = {
.start_unit = 0,
@@ -1240,21 +1240,12 @@ static int dasdfmt_release_space(void)
int err = 0;
if (!g.ese || g.no_discard)
- return 0;
+ return;
printf("Releasing space for the entire device...\n");
err = dasd_release_space(g.dev_node, &r);
- /*
- * Warn or Error on failing RAS depending on QUICK mode set explicitly or automatically
- */
- if (err && !g.mode_specified) {
- warnx("Could not release space. Falling back to full format.");
- return 1;
- } else if (err && g.mode_specified) {
+ if (err)
error("Could not release space: %s", strerror(err));
- }
-
- return 0;
}
static void dasdfmt_prepare_and_format(unsigned int cylinders, unsigned int heads,
@@ -1454,12 +1445,8 @@ static void do_format_dasd(volume_label_t *vlabel, format_data_t *p,
dasdfmt_prepare_and_format(cylinders, heads, p);
break;
case QUICK:
- if (dasdfmt_release_space()) {
- p->stop_unit = (cylinders * heads) - 1;
- dasdfmt_prepare_and_format(cylinders, heads, p);
- } else {
- dasdfmt_quick_format(cylinders, heads, p);
- }
+ dasdfmt_release_space();
+ dasdfmt_quick_format(cylinders, heads, p);
break;
case EXPAND:
dasdfmt_expand_format(cylinders, heads, p);
@@ -1491,7 +1478,7 @@ static void eval_format_mode(void)
}
if (!g.mode_specified)
- mode = g.ese ? QUICK : FULL;
+ mode = FULL;
}
/*