Use 32KB/4KB for default block/fragment size on >= 128 GB partitions

for modern AFT disks.  No particular comments against PR install/46629.
This commit is contained in:
tsutsui 2012-06-30 15:34:01 +00:00
parent e631798833
commit c0aba6b3c5
3 changed files with 43 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $ */
/* $NetBSD: label.c,v 1.62 2012/06/30 15:34:01 tsutsui Exp $ */
/*
* Copyright 1997 Jonathan Stone
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: label.c,v 1.61 2012/01/05 22:18:36 christos Exp $");
__RCSID("$NetBSD: label.c,v 1.62 2012/06/30 15:34:01 tsutsui Exp $");
#endif
#include <sys/types.h>
@ -213,8 +213,23 @@ set_ptype(partinfo *p, int fstype, int flag)
p->pi_fstype = fstype;
if (fstype == FS_BSDFFS || fstype == FS_BSDLFS) {
p->pi_frag = 8;
/* match newfs defaults for fragments size (2k if >= 1024MB) */
p->pi_fsize = p->pi_size > 1024*1024*1024 / 512 ? 2048 : 1024;
/*
* match newfs defaults for fragments size:
* fs size frag size
* < 20 MB 0.5 KB
* < 1000 MB 1 KB
* < 128 GB 2 KB
* >= 128 GB 4 KB
*/
/* note pi_size is uint32_t so we have to avoid overflow */
if (p->pi_size < (20 * 1024 * (1024 / 512)))
p->pi_fsize = 512;
else if (p->pi_size < (1000 * 1024 * (1024 / 512)))
p->pi_fsize = 1024;
else if (p->pi_size < (128 * 1024 * 1024 * (1024 / 512)))
p->pi_fsize = 2048;
else
p->pi_fsize = 4096;
} else {
/* zero - fields not used */
p->pi_frag = 0;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: newfs.8,v 1.82 2011/05/14 19:46:10 dholland Exp $
.\" $NetBSD: newfs.8,v 1.83 2012/06/30 15:34:01 tsutsui Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)newfs.8 8.6 (Berkeley) 5/3/95
.\"
.Dd May 14, 2011
.Dd June 30, 2012
.Dt NEWFS 8
.Os
.Sh NAME
@ -111,10 +111,12 @@ The default size depends upon the size of the file system:
.Ar block-size
.It \*[Lt] 20 MB
4 KB
.It \*[Lt] 1024 MB
.It \*[Lt] 1000 MB
8 KB
.It \*[Gt]= 1024 MB
.It \*[Lt] 128 GB
16 KB
.It \*[Gt]= 128 GB
32 KB
.El
.It Fl d Ar maxbsize
Set the maximum extent size to
@ -151,10 +153,12 @@ The default size depends upon the size of the file system:
.Ar frag-size
.It \*[Lt] 20 MB
0.5 KB
.It \*[Lt] 1024 MB
.It \*[Lt] 1000 MB
1 KB
.It \*[Gt]= 1024 MB
.It \*[Lt] 128 GB
2 KB
.It \*[Gt]= 128 GB
4 KB
.El
.It Fl G
Treat garbage parameters as non-fatal.
@ -182,10 +186,12 @@ bytes of data space:
.Ar bytes-per-inode
.It \*[Lt] 20 MB
2 KB
.It \*[Lt] 1024 MB
.It \*[Lt] 1000 MB
4 KB
.It \*[Gt]= 1024 MB
.It \*[Lt] 128 GB
8 KB
.It \*[Gt]= 128 GB
16 KB
.El
.It Fl m Ar free-space
The percentage of space reserved from normal users; the minimum free

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs.c,v 1.110 2012/02/13 12:59:56 wiz Exp $ */
/* $NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $ */
/*
* Copyright (c) 1983, 1989, 1993, 1994
@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993, 1994\
#if 0
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: newfs.c,v 1.110 2012/02/13 12:59:56 wiz Exp $");
__RCSID("$NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $");
#endif
#endif /* not lint */
@ -157,14 +157,17 @@ const char lmsg[] = "%s: can't read disk label";
*/
/*
* For file systems smaller than SMALL_FSSIZE we use the S_DFL_* defaults,
* otherwise if less than MEDIUM_FSSIZE use M_DFL_*, otherwise use
* L_DFL_*.
* otherwise if less than MEDIUM_FSSIZE use M_DFL_*,
* otherwise if less than LARGE_FSSIZE use L_DFL_*,
* otherwise use LL_DFL_* especially for modern AFT disks.
*/
#define SMALL_FSSIZE (20*1024*2)
#define S_DFL_FRAGSIZE 512
#define MEDIUM_FSSIZE (1000*1024*2)
#define M_DFL_FRAGSIZE 1024
#define LARGE_FSSIZE (128*1024*1024*2)
#define L_DFL_FRAGSIZE 2048
#define LL_DFL_FRAGSIZE 4096
#define DFL_FRAG_BLK 8
/* Apple requires the fragment size to be at least APPLEUFS_DIRBLKSIZ
@ -624,8 +627,10 @@ main(int argc, char *argv[])
fsize = S_DFL_FRAGSIZE;
else if (fssize < MEDIUM_FSSIZE)
fsize = M_DFL_FRAGSIZE;
else
else if (fssize < LARGE_FSSIZE)
fsize = L_DFL_FRAGSIZE;
else
fsize = LL_DFL_FRAGSIZE;
if (fsize < sectorsize)
fsize = sectorsize;
}