Module Name: src Committed By: snj Date: Tue Mar 8 10:03:57 UTC 2016
Modified Files: src/sbin/dump [netbsd-6]: dump.8 main.c rcache.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1331): sbin/dump/dump.8: revision 1.67 via patch sbin/dump/main.c: revision 1.72 sbin/dump/rcache.c: revision 1.25 Default the read block size (-k default value) to kern.maxphys (usually 64k these days). This gives a noticable performance boost on large filesystems. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.62.8.1 src/sbin/dump/dump.8 cvs rdiff -u -r1.66 -r1.66.8.1 src/sbin/dump/main.c cvs rdiff -u -r1.23 -r1.23.8.1 src/sbin/dump/rcache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/dump/dump.8 diff -u src/sbin/dump/dump.8:1.62 src/sbin/dump/dump.8:1.62.8.1 --- src/sbin/dump/dump.8:1.62 Fri Nov 5 10:02:53 2010 +++ src/sbin/dump/dump.8 Tue Mar 8 10:03:57 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dump.8,v 1.62 2010/11/05 10:02:53 hannken Exp $ +.\" $NetBSD: dump.8,v 1.62.8.1 2016/03/08 10:03:57 snj Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" Regents of the University of California. @@ -30,7 +30,7 @@ .\" .\" @(#)dump.8 8.3 (Berkeley) 5/1/95 .\" -.Dd November 5, 2010 +.Dd August 24, 2015 .Dt DUMP 8 .Os .Sh NAME @@ -208,7 +208,9 @@ dump. .It Fl k Ar read-blocksize The size in kilobyte of the read buffers, rounded up to a multiple of the file system block size. -Default is 32k. +Default is the value of the +.Xr sysctl 7 +kern.maxphys. .It Fl l Ar timeout If a tape change is required, eject the tape and wait for the drive to be ready again. Index: src/sbin/dump/main.c diff -u src/sbin/dump/main.c:1.66 src/sbin/dump/main.c:1.66.8.1 --- src/sbin/dump/main.c:1.66 Thu Mar 11 01:32:59 2010 +++ src/sbin/dump/main.c Tue Mar 8 10:03:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.66 2010/03/11 01:32:59 christos Exp $ */ +/* $NetBSD: main.c,v 1.66.8.1 2016/03/08 10:03:57 snj Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #else -__RCSID("$NetBSD: main.c,v 1.66 2010/03/11 01:32:59 christos Exp $"); +__RCSID("$NetBSD: main.c,v 1.66.8.1 2016/03/08 10:03:57 snj Exp $"); #endif #endif /* not lint */ @@ -47,6 +47,7 @@ __RCSID("$NetBSD: main.c,v 1.66 2010/03/ #include <sys/time.h> #include <sys/stat.h> #include <sys/mount.h> +#include <sys/sysctl.h> #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> @@ -81,7 +82,7 @@ long dev_bsize = 1; /* recalculated bel long blocksperfile; /* output blocks per file */ const char *host; /* remote host (if any) */ int readcache = -1; /* read cache size (in readblksize blks) */ -int readblksize = 32 * 1024; /* read block size */ +int readblksize = -1; /* read block size */ char default_time_string[] = "%T %Z"; /* default timestamp string */ char *time_string = default_time_string; /* timestamp string */ Index: src/sbin/dump/rcache.c diff -u src/sbin/dump/rcache.c:1.23 src/sbin/dump/rcache.c:1.23.8.1 --- src/sbin/dump/rcache.c:1.23 Wed Jan 27 12:20:25 2010 +++ src/sbin/dump/rcache.c Tue Mar 8 10:03:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rcache.c,v 1.23 2010/01/27 12:20:25 spz Exp $ */ +/* $NetBSD: rcache.c,v 1.23.8.1 2016/03/08 10:03:57 snj Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: rcache.c,v 1.23 2010/01/27 12:20:25 spz Exp $"); +__RCSID("$NetBSD: rcache.c,v 1.23.8.1 2016/03/08 10:03:57 snj Exp $"); #endif /* not lint */ #include <sys/types.h> @@ -99,6 +99,19 @@ initcache(int cachesize, int readblksize size_t len; size_t sharedSize; + if (readblksize == -1) { /* use kern.maxphys */ + int kern_maxphys; + int mib[2] = { CTL_KERN, KERN_MAXPHYS }; + + len = sizeof(kern_maxphys); + if (sysctl(mib, 2, &kern_maxphys, &len, NULL, 0) < 0) { + msg("sysctl(kern.maxphys) failed: %s\n", + strerror(errno)); + return; + } + readblksize = kern_maxphys; + } + /* Convert read block size in terms of filesystem block size */ nblksread = howmany(readblksize, ufsib->ufs_bsize);