summaryrefslogtreecommitdiffstats
path: root/sbin/dump/main.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2003-01-13 19:42:41 +0000
committerdillon <dillon@FreeBSD.org>2003-01-13 19:42:41 +0000
commit5b697ad7ba32cd4546d0a6a44b4ef2a58cc6f9e9 (patch)
treeaf69e0b4486eed6e705fe04be584e57921195acb /sbin/dump/main.c
parentd0082e294ce62cf63d5aa4738b8f999e18b04fff (diff)
downloadFreeBSD-src-5b697ad7ba32cd4546d0a6a44b4ef2a58cc6f9e9.zip
FreeBSD-src-5b697ad7ba32cd4546d0a6a44b4ef2a58cc6f9e9.tar.gz
Add a caching option to dump. Use -C. Note that NetBSD has a caching option
called -r but it takes 512 byte blocks instead of megabytes, and I felt a megabytes specification would be far more useful so I did not use the same option character. This will *greatly* improve dump performance at the cost of possibly missing filesystem changes that occur between passes, and does a fairly good job making up for the loss of buffered block devices. Caching is disabled by default to retain historical behavior. In tests, dump performance improved by about 40% when dumping / or /usr. Beware that dump forks and the cache may wind up being larger then you specify, but a more complex shared memory implementation would not produce results that are all that much better so I kept it simple for now. MFC after: 3 days
Diffstat (limited to 'sbin/dump/main.c')
-rw-r--r--sbin/dump/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 34223b1..7fcf112 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -82,6 +82,7 @@ int density = 0; /* density in bytes/0.1" " <- this is for hilit19 */
int ntrec = NTREC; /* # tape blocks in each tape record */
int cartridge = 0; /* Assume non-cartridge tape */
int dokerberos = 0; /* Use Kerberos authentication */
+int cachesize = 0; /* block cache size (in bytes), defaults to 0 */
long dev_bsize = 1; /* recalculated below */
long blocksperfile; /* output blocks per file */
char *host = NULL; /* remote host (if any) */
@@ -127,9 +128,9 @@ main(int argc, char *argv[])
obsolete(&argc, &argv);
#ifdef KERBEROS
-#define optstring "0123456789aB:b:cd:f:h:kLns:ST:uWwD:"
+#define optstring "0123456789aB:b:cd:f:h:kLns:ST:uWwD:C:"
#else
-#define optstring "0123456789aB:b:cd:f:h:Lns:ST:uWwD:"
+#define optstring "0123456789aB:b:cd:f:h:Lns:ST:uWwD:C:"
#endif
while ((ch = getopt(argc, argv, optstring)) != -1)
#undef optstring
@@ -172,6 +173,10 @@ main(int argc, char *argv[])
dumpdates = optarg;
break;
+ case 'C':
+ cachesize = numarg("cachesize", 0, 0) * 1024 * 1024;
+ break;
+
case 'h':
honorlevel = numarg("honor level", 0L, 10L);
break;
OpenPOWER on IntegriCloud