diff options
author | dillon <dillon@FreeBSD.org> | 2003-01-25 19:06:30 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2003-01-25 19:06:30 +0000 |
commit | 401c72026168bcd0604cb05f2074b300c1f84a9e (patch) | |
tree | 14f9546d441e78959bfc98a6a216670c48c85594 | |
parent | 1340379168346186889f32c8a4199329de4f660d (diff) | |
download | FreeBSD-src-401c72026168bcd0604cb05f2074b300c1f84a9e.zip FreeBSD-src-401c72026168bcd0604cb05f2074b300c1f84a9e.tar.gz |
Readjust the cache initialization code to make it more obvious that the
cache is bypassed when disabled.
-rw-r--r-- | sbin/dump/cache.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sbin/dump/cache.c b/sbin/dump/cache.c index c049466..906ac27 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; } |