diff options
author | dillon <dillon@FreeBSD.org> | 2003-01-13 19:42:41 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2003-01-13 19:42:41 +0000 |
commit | 5b697ad7ba32cd4546d0a6a44b4ef2a58cc6f9e9 (patch) | |
tree | af69e0b4486eed6e705fe04be584e57921195acb /sbin/dump/traverse.c | |
parent | d0082e294ce62cf63d5aa4738b8f999e18b04fff (diff) | |
download | FreeBSD-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/traverse.c')
-rw-r--r-- | sbin/dump/traverse.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c index ab2ee71..ec0d56e 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++) { |