Fix some serious brain damage in the default block/frag/cpg parameters
that are used if none at all are specified for a partition. Don't keep replaying the last field if we run out of fields when processing a line. Use a 8:1 frag:block ratio for both defaults. More work here is required. I think disklabel should not attempt to choose default filesystem parameters, and instead let newfs pick any defaults if required. PR: i386/38703 Reported by: Martin Kraemer <Martin.Kraemer@Fujitsu-Siemens.com>
This commit is contained in:
parent
67b46708ef
commit
f1a7b7ee8d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97535
@ -94,7 +94,7 @@ static const char rcsid[] =
|
|||||||
#define DEFAULT_NEWFS_CPG 16U
|
#define DEFAULT_NEWFS_CPG 16U
|
||||||
|
|
||||||
#define BIG_NEWFS_BLOCK 16384U
|
#define BIG_NEWFS_BLOCK 16384U
|
||||||
#define BIG_NEWFS_FRAG 4096U
|
#define BIG_NEWFS_FRAG 2048U
|
||||||
#define BIG_NEWFS_CPG 64U
|
#define BIG_NEWFS_CPG 64U
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__ia64__)
|
#if defined(__i386__) || defined(__ia64__)
|
||||||
@ -1169,8 +1169,6 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
|||||||
return (1); \
|
return (1); \
|
||||||
} else { \
|
} else { \
|
||||||
cp = tp, tp = word(cp); \
|
cp = tp, tp = word(cp); \
|
||||||
if (tp == NULL) \
|
|
||||||
tp = cp; \
|
|
||||||
(n) = atoi(cp); \
|
(n) = atoi(cp); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1183,8 +1181,6 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
|||||||
} else { \
|
} else { \
|
||||||
char *tmp; \
|
char *tmp; \
|
||||||
cp = tp, tp = word(cp); \
|
cp = tp, tp = word(cp); \
|
||||||
if (tp == NULL) \
|
|
||||||
tp = cp; \
|
|
||||||
(n) = strtol(cp,&tmp,10); \
|
(n) = strtol(cp,&tmp,10); \
|
||||||
if (tmp) (w) = *tmp; \
|
if (tmp) (w) = *tmp; \
|
||||||
} \
|
} \
|
||||||
@ -1278,12 +1274,14 @@ getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno)
|
|||||||
/*
|
/*
|
||||||
* FIX! These are too low, but are traditional
|
* FIX! These are too low, but are traditional
|
||||||
*/
|
*/
|
||||||
pp->p_fsize = DEFAULT_NEWFS_BLOCK;
|
pp->p_fsize = DEFAULT_NEWFS_FRAG;
|
||||||
pp->p_frag = (unsigned char) DEFAULT_NEWFS_FRAG;
|
pp->p_frag = DEFAULT_NEWFS_BLOCK /
|
||||||
|
DEFAULT_NEWFS_FRAG;
|
||||||
pp->p_cpg = DEFAULT_NEWFS_CPG;
|
pp->p_cpg = DEFAULT_NEWFS_CPG;
|
||||||
} else {
|
} else {
|
||||||
pp->p_fsize = BIG_NEWFS_BLOCK;
|
pp->p_fsize = BIG_NEWFS_FRAG;
|
||||||
pp->p_frag = (unsigned char) BIG_NEWFS_FRAG;
|
pp->p_frag = BIG_NEWFS_BLOCK /
|
||||||
|
BIG_NEWFS_FRAG;
|
||||||
pp->p_cpg = BIG_NEWFS_CPG;
|
pp->p_cpg = BIG_NEWFS_CPG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ static const char rcsid[] =
|
|||||||
#define DEFAULT_NEWFS_CPG 16U
|
#define DEFAULT_NEWFS_CPG 16U
|
||||||
|
|
||||||
#define BIG_NEWFS_BLOCK 16384U
|
#define BIG_NEWFS_BLOCK 16384U
|
||||||
#define BIG_NEWFS_FRAG 4096U
|
#define BIG_NEWFS_FRAG 2048U
|
||||||
#define BIG_NEWFS_CPG 64U
|
#define BIG_NEWFS_CPG 64U
|
||||||
|
|
||||||
#if defined(__i386__) || defined(__ia64__)
|
#if defined(__i386__) || defined(__ia64__)
|
||||||
@ -1169,8 +1169,6 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
|||||||
return (1); \
|
return (1); \
|
||||||
} else { \
|
} else { \
|
||||||
cp = tp, tp = word(cp); \
|
cp = tp, tp = word(cp); \
|
||||||
if (tp == NULL) \
|
|
||||||
tp = cp; \
|
|
||||||
(n) = atoi(cp); \
|
(n) = atoi(cp); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@ -1183,8 +1181,6 @@ getasciilabel(FILE *f, struct disklabel *lp)
|
|||||||
} else { \
|
} else { \
|
||||||
char *tmp; \
|
char *tmp; \
|
||||||
cp = tp, tp = word(cp); \
|
cp = tp, tp = word(cp); \
|
||||||
if (tp == NULL) \
|
|
||||||
tp = cp; \
|
|
||||||
(n) = strtol(cp,&tmp,10); \
|
(n) = strtol(cp,&tmp,10); \
|
||||||
if (tmp) (w) = *tmp; \
|
if (tmp) (w) = *tmp; \
|
||||||
} \
|
} \
|
||||||
@ -1278,12 +1274,14 @@ getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno)
|
|||||||
/*
|
/*
|
||||||
* FIX! These are too low, but are traditional
|
* FIX! These are too low, but are traditional
|
||||||
*/
|
*/
|
||||||
pp->p_fsize = DEFAULT_NEWFS_BLOCK;
|
pp->p_fsize = DEFAULT_NEWFS_FRAG;
|
||||||
pp->p_frag = (unsigned char) DEFAULT_NEWFS_FRAG;
|
pp->p_frag = DEFAULT_NEWFS_BLOCK /
|
||||||
|
DEFAULT_NEWFS_FRAG;
|
||||||
pp->p_cpg = DEFAULT_NEWFS_CPG;
|
pp->p_cpg = DEFAULT_NEWFS_CPG;
|
||||||
} else {
|
} else {
|
||||||
pp->p_fsize = BIG_NEWFS_BLOCK;
|
pp->p_fsize = BIG_NEWFS_FRAG;
|
||||||
pp->p_frag = (unsigned char) BIG_NEWFS_FRAG;
|
pp->p_frag = BIG_NEWFS_BLOCK /
|
||||||
|
BIG_NEWFS_FRAG;
|
||||||
pp->p_cpg = BIG_NEWFS_CPG;
|
pp->p_cpg = BIG_NEWFS_CPG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user