aboutsummaryrefslogtreecommitdiff
path: root/sbin/dump/traverse.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2003-01-13 19:42:41 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2003-01-13 19:42:41 +0000
commit5941e412cacd0ebc654224ca69f66ae18f351b89 (patch)
treeaf69e0b4486eed6e705fe04be584e57921195acb /sbin/dump/traverse.c
parentb4206324a5dd20c09e181ba9d76b9712c1e56700 (diff)
downloadsrc-5941e412cacd0ebc654224ca69f66ae18f351b89.tar.gz
src-5941e412cacd0ebc654224ca69f66ae18f351b89.zip
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
Notes
Notes: svn path=/head/; revision=109187
Diffstat (limited to 'sbin/dump/traverse.c')
-rw-r--r--sbin/dump/traverse.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c
index ab2ee71aa2a0..ec0d56e547ff 100644
--- a/sbin/dump/traverse.c
+++ b/sbin/dump/traverse.c
@@ -739,8 +739,8 @@ bread(ufs2_daddr_t blkno, char *buf, int size)
int cnt, i;
loop:
- if ((cnt = pread(diskfd, buf, size, ((off_t)blkno << dev_bshift))) ==
- size)
+ cnt = cread(diskfd, buf, size, ((off_t)blkno << dev_bshift));
+ if (cnt == size)
return;
if (blkno + (size / dev_bsize) > fsbtodb(sblock, sblock->fs_size)) {
/*
@@ -774,7 +774,8 @@ loop:
breaderrors = 0;
}
/*
- * Zero buffer, then try to read each sector of buffer separately.
+ * Zero buffer, then try to read each sector of buffer separately,
+ * and bypass the cache.
*/
memset(buf, 0, size);
for (i = 0; i < size; i += dev_bsize, buf += dev_bsize, blkno++) {