diff options
author | gibbs <gibbs@FreeBSD.org> | 1995-01-04 23:50:30 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1995-01-04 23:50:30 +0000 |
commit | e9de78da56a957d8d3e17e3b40056f077a28d648 (patch) | |
tree | 43136cda943ecf74d7842b7089cc81f56564d863 /sbin/newlfs | |
parent | 0df1a28aca294be711d5a5643c0d9a0e2a34aa65 (diff) | |
download | FreeBSD-src-e9de78da56a957d8d3e17e3b40056f077a28d648.zip FreeBSD-src-e9de78da56a957d8d3e17e3b40056f077a28d648.tar.gz |
Honor the values for bsize, fsize and bps from the disklabel.
Diffstat (limited to 'sbin/newlfs')
-rw-r--r-- | sbin/newlfs/config.h | 10 | ||||
-rw-r--r-- | sbin/newlfs/lfs.c | 8 | ||||
-rw-r--r-- | sbin/newlfs/newfs.c | 17 |
3 files changed, 25 insertions, 10 deletions
diff --git a/sbin/newlfs/config.h b/sbin/newlfs/config.h index 9c8b394..55fed69 100644 --- a/sbin/newlfs/config.h +++ b/sbin/newlfs/config.h @@ -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 diff --git a/sbin/newlfs/lfs.c b/sbin/newlfs/lfs.c index 99387ff..72c5f46 100644 --- a/sbin/newlfs/lfs.c +++ b/sbin/newlfs/lfs.c @@ -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); diff --git a/sbin/newlfs/newfs.c b/sbin/newlfs/newfs.c index 25ac7f0..2f7c11f 100644 --- a/sbin/newlfs/newfs.c +++ b/sbin/newlfs/newfs.c @@ -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)); |