mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-29 20:54:13 +01:00
Honor the values for bsize, fsize and bps from the disklabel.
This commit is contained in:
parent
0df1a28aca
commit
e9de78da56
@ -84,7 +84,7 @@
|
||||
* determining the rotationally optimal layout for disk blocks
|
||||
* within a file; the default of fs_rotdelay is 4ms.
|
||||
*/
|
||||
#define ROTDELAY 4
|
||||
#define ROTDELAY 0
|
||||
|
||||
/*
|
||||
* MAXCONTIG sets the default for the maximum number of blocks
|
||||
@ -115,7 +115,7 @@
|
||||
* rotational positions that we distinguish. With NRPOS of 8 the resolution
|
||||
* of our summary information is 2ms for a typical 3600 rpm drive.
|
||||
*/
|
||||
#define NRPOS 8 /* number distinct rotational positions */
|
||||
#define NRPOS 1 /* number distinct rotational positions */
|
||||
|
||||
/*
|
||||
* The following constants set the default block and segment size for a log
|
||||
@ -129,6 +129,6 @@
|
||||
#define DFL_LFSSEG_MASK 0xFFFFF
|
||||
|
||||
#define LFS_MINBLOCKSIZE 1024
|
||||
#define DFL_LFSBLOCK 4096
|
||||
#define DFL_LFSBLOCK_SHIFT 12
|
||||
#define DFL_LFSBLOCK_MASK 0xFFF
|
||||
#define DFL_LFSBLOCK 8192
|
||||
#define DFL_LFSBLOCK_SHIFT 13
|
||||
#define DFL_LFSBLOCK_MASK 0x1FFF
|
||||
|
@ -167,12 +167,12 @@ static void make_dir __P(( void *, struct direct *, int));
|
||||
static void put __P((int, off_t, void *, size_t));
|
||||
|
||||
int
|
||||
make_lfs(fd, lp, partp, minfree, block_size, seg_size)
|
||||
make_lfs(fd, lp, partp, minfree, bsize, seg_size)
|
||||
int fd;
|
||||
struct disklabel *lp;
|
||||
struct partition *partp;
|
||||
int minfree;
|
||||
int block_size;
|
||||
int bsize;
|
||||
int seg_size;
|
||||
{
|
||||
struct dinode *dip; /* Pointer to a disk inode */
|
||||
@ -197,7 +197,6 @@ make_lfs(fd, lp, partp, minfree, block_size, seg_size)
|
||||
u_long *dp; /* Used to computed checksum on data */
|
||||
u_long *datasump; /* Used to computed checksum on data */
|
||||
int block_array_size; /* How many entries in block array */
|
||||
int bsize; /* Block size */
|
||||
int db_per_fb; /* Disk blocks per file block */
|
||||
int i, j;
|
||||
int off; /* Offset at which to write */
|
||||
@ -208,8 +207,6 @@ make_lfs(fd, lp, partp, minfree, block_size, seg_size)
|
||||
|
||||
lfsp = &lfs_default;
|
||||
|
||||
if (!(bsize = block_size))
|
||||
bsize = DFL_LFSBLOCK;
|
||||
if (!(ssize = seg_size))
|
||||
ssize = DFL_LFSSEG;
|
||||
|
||||
@ -222,6 +219,7 @@ make_lfs(fd, lp, partp, minfree, block_size, seg_size)
|
||||
lfsp->lfs_fsize = bsize;
|
||||
lfsp->lfs_bmask = bsize - 1;
|
||||
lfsp->lfs_inopb = bsize / sizeof(struct dinode);
|
||||
|
||||
/* MIS -- should I round to power of 2 */
|
||||
lfsp->lfs_ifpb = bsize / sizeof(IFILE);
|
||||
lfsp->lfs_sepb = bsize / sizeof(SEGUSE);
|
||||
|
@ -312,6 +312,23 @@ main(argc, argv)
|
||||
pp = &lp->d_partitions[*cp - 'a'];
|
||||
if (pp->p_size == 0)
|
||||
fatal("%s: `%c' partition is unavailable", argv[0], *cp);
|
||||
if (fsize == 0) {
|
||||
fsize = pp->p_fsize;
|
||||
if (fsize <= 0)
|
||||
fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);
|
||||
}
|
||||
|
||||
if (bsize == 0) {
|
||||
bsize = pp->p_frag * fsize;
|
||||
if (bsize <= 0)
|
||||
bsize = MIN(DFL_LFSBLOCK, 8 * fsize);
|
||||
}
|
||||
|
||||
if (segsize == 0) {
|
||||
segsize = pp->p_cpg * bsize;
|
||||
if (segsize <= 0)
|
||||
segsize = DFL_LFSSEG;
|
||||
}
|
||||
|
||||
/* If we're making a LFS, we break out here */
|
||||
exit(make_lfs(fso, lp, pp, minfree, bsize, segsize));
|
||||
|
Loading…
Reference in New Issue
Block a user