s390utils/0058-fdasd-dasdfmt-fix-format-7-label.patch
2011-03-25 14:59:32 +01:00

97 lines
3.1 KiB
Diff

From f877ca62c13e475d55f6fe3fac5c9732ed44b49e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Fri, 28 Jan 2011 14:27:39 +0100
Subject: [PATCH 58/61] fdasd/dasdfmt: fix format 7 label
Description: fdasd/dasdfmt: fix format 7 label
Symptom: Backups of Linux on System z disks from z/OS do not work
when the disk is not fully partitioned.
Problem: The format 7 label written by fdasd and dasdfmt is incorrect.
The extend for free space has one track less than required
which is recognized as inconsistent vtoc state by z/OS tools.
Solution: Fix libvtoc to write the format 7 label correctly.
---
libvtoc/vtoc.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/libvtoc/vtoc.c b/libvtoc/vtoc.c
index cebd5a4..36269a4 100644
--- a/libvtoc/vtoc.c
+++ b/libvtoc/vtoc.c
@@ -1204,7 +1204,7 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
if ((ext->a + ext->b) == 0x00000000)
continue;
- if ((ext->b + 1) == tmp->a) {
+ if ((ext->b) == tmp->a) {
/* this extent precedes the new one */
ext->b = tmp->b;
bzero(tmp, sizeof(ds7ext_t));
@@ -1216,7 +1216,7 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
continue;
}
- if (ext->a == (tmp->b + 1))
+ if (ext->a == (tmp->b))
{
/* this extent succeeds the new one */
ext->a = tmp->a;
@@ -1240,7 +1240,7 @@ void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
{
ds7ext_t *ext;
int i, counter=0;
-
+
for (i=0; i<16; i++) {
if (i<5)
ext = &f7->DS7EXTNT[i];
@@ -1258,7 +1258,7 @@ void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a == ext->a) && (b < ext->b)) {
/* left-bounded in free space gap */
- ext->a = b + 1;
+ ext->a = b;
if (verbose)
printf("FMT7 add extent: left-bounded\n");
counter++;
@@ -1267,7 +1267,7 @@ void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a > ext->a) && (b == ext->b)) {
/* right-bounded in free space gap */
- ext->b = a - 1;
+ ext->b = a;
if (verbose)
printf("FMT7 add extent: right-bounded\n");
counter++;
@@ -1277,8 +1277,8 @@ void vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
if ((a > ext->a) && (b < ext->b)) {
/* partition devides free space into 2 pieces */
vtoc_update_format7_label_add(f7, verbose,
- b+1, ext->b);
- ext->b = a - 1;
+ b, ext->b);
+ ext->b = a;
if (verbose)
printf("FMT7 add extent: 2 pieces\n");
counter++;
@@ -1311,10 +1311,14 @@ void vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5,
{
if ((cyl * trk) > BIG_DISK_SIZE) {
if (ch == '+') {
- vtoc_update_format7_label_add(f7, verbose, start,stop);
+ vtoc_update_format7_label_add(f7, verbose, start,
+ /* ds7ext RTA + 1 */
+ stop + 1);
}
else if (ch == '-') {
- vtoc_update_format7_label_del(f7, verbose, start,stop);
+ vtoc_update_format7_label_del(f7, verbose, start,
+ /* ds7ext RTA + 1 */
+ stop + 1);
}
else {
printf("BUG: syntax error in vtoc_set_freespace.\n");
--
1.7.3.5