aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2003-01-25 19:06:30 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2003-01-25 19:06:30 +0000
commit049b1245befbb294115b7a41aa193b948ec69b70 (patch)
tree14f9546d441e78959bfc98a6a216670c48c85594
parentd923c5986ef6b5f2e67f544750ef67218df12320 (diff)
Notes
-rw-r--r--sbin/dump/cache.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sbin/dump/cache.c b/sbin/dump/cache.c
index c049466c4115..906ac2716959 100644
--- a/sbin/dump/cache.c
+++ b/sbin/dump/cache.c
@@ -88,14 +88,14 @@ cread(int fd, void *buf, size_t nbytes, off_t offset)
off_t mask;
/*
- * If the cache is disabled, revert to pread. If the
- * cache has not been initialized, initialize the cache.
+ * If the cache is disabled, or we do not yet know the filesystem
+ * block size, then revert to pread. Otherwise initialize the
+ * cache as necessary and continue.
*/
- if (sblock->fs_bsize && DataBase == NULL) {
- if (cachesize <= 0)
- return(pread(fd, buf, nbytes, offset));
+ if (cachesize <= 0 || sblock->fs_bsize == 0)
+ return(pread(fd, buf, nbytes, offset));
+ if (DataBase == NULL)
cinit();
- }
/*
* If the request crosses a cache block boundary, or the
@@ -118,13 +118,8 @@ cread(int fd, void *buf, size_t nbytes, off_t offset)
pblk = &BlockHash[hi];
ppblk = NULL;
while ((blk = *pblk) != NULL) {
- if (((blk->b_Offset ^ offset) & mask) == 0) {
-#if 0
- fprintf(stderr, "%08llx %d (%08x)\n", offset, nbytes,
- sblock->fs_size * sblock->fs_fsize);
-#endif
+ if (((blk->b_Offset ^ offset) & mask) == 0)
break;
- }
ppblk = pblk;
pblk = &blk->b_HNext;
}