From 3ef5a51ffb89d2d052dee336f16e8ed122e33f56 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Mon, 29 May 2000 07:53:58 +0000 Subject: [PATCH] DW: - The 'flag' parameter of storeDirValidFileno got deleted when it became storeDirFSValidFileno (at least for diskd and ufs). This flag is important for rebuilding. When the flag is set, it enables the out-of-range check against the filemap size. Without this check, the filemap does not grow during the rebuild procedure. Instead, all objects with file numbers larger than the default (16k?) get declared invalid and most of the cached objects are lost. --- src/fs/diskd/store_dir_diskd.cc | 19 ++++++++++++------- src/fs/ufs/store_dir_ufs.cc | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/fs/diskd/store_dir_diskd.cc b/src/fs/diskd/store_dir_diskd.cc index 1d6284900b..5477e18e71 100644 --- a/src/fs/diskd/store_dir_diskd.cc +++ b/src/fs/diskd/store_dir_diskd.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.8 2000/05/29 00:30:44 wessels Exp $ + * $Id: store_dir_diskd.cc,v 1.9 2000/05/29 01:53:58 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -128,7 +128,7 @@ static int storeDiskdFilenoBelongsHere(int fn, int F0, int F1, int F2); static int storeDiskdCleanupDoubleCheck(SwapDir *, StoreEntry *); static void storeDiskdDirStats(SwapDir *, StoreEntry *); static void storeDiskdDirInitBitmap(SwapDir *); -static int storeDiskdDirValidFileno(SwapDir *, sfileno); +static int storeDiskdDirValidFileno(SwapDir *, sfileno, int); static int storeDiskdDirCheckExpired(SwapDir *, StoreEntry *); #if !HEAP_REPLACEMENT static time_t storeDiskdDirExpiredReferenceAge(SwapDir *); @@ -725,7 +725,7 @@ storeDiskdDirRebuildFromSwapLog(void *data) if ((++rb->counts.scancount & 0xFFFF) == 0) debug(20, 3) (" %7d %s Entries read so far.\n", rb->counts.scancount, rb->sd->path); - if (!storeDiskdDirValidFileno(SD, s.swap_filen)) { + if (!storeDiskdDirValidFileno(SD, s.swap_filen, 0)) { rb->counts.invalid++; continue; } @@ -1289,7 +1289,7 @@ storeDiskdDirClean(int swap_index) if (sscanf(de->d_name, "%X", &swapfileno) != 1) continue; fn = swapfileno; /* XXX should remove this cruft ! */ - if (storeDiskdDirValidFileno(SD, fn)) + if (storeDiskdDirValidFileno(SD, fn, 1)) if (storeDiskdDirMapBitTest(SD, fn)) if (storeDiskdFilenoBelongsHere(fn, D0, D1, D2)) continue; @@ -1397,13 +1397,18 @@ storeDiskdFilenoBelongsHere(int fn, int F0, int F1, int F2) } int -storeDiskdDirValidFileno(SwapDir * SD, sfileno filn) +storeDiskdDirValidFileno(SwapDir * SD, sfileno filn, int flag) { diskdinfo_t *diskdinfo = SD->fsdata; if (filn < 0) return 0; - if (filn > diskdinfo->map->max_n_files) - return 0; + /* + * If flag is set it means out-of-range file number should + * be considered invalid. + */ + if (flag) + if (filn > diskdinfo->map->max_n_files) + return 0; return 1; } diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index c1d12e3822..9c7db81b00 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.2 2000/05/12 00:29:20 wessels Exp $ + * $Id: store_dir_ufs.cc,v 1.3 2000/05/29 01:54:02 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -118,7 +118,7 @@ static int storeUfsFilenoBelongsHere(int fn, int F0, int F1, int F2); static int storeUfsCleanupDoubleCheck(SwapDir *, StoreEntry *); static void storeUfsDirStats(SwapDir *, StoreEntry *); static void storeUfsDirInitBitmap(SwapDir *); -static int storeUfsDirValidFileno(SwapDir *, sfileno); +static int storeUfsDirValidFileno(SwapDir *, sfileno, int); static int storeUfsDirCheckExpired(SwapDir *, StoreEntry *); #if !HEAP_REPLACEMENT static time_t storeUfsDirExpiredReferenceAge(SwapDir *); @@ -576,7 +576,7 @@ storeUfsDirRebuildFromSwapLog(void *data) if ((++rb->counts.scancount & 0xFFFF) == 0) debug(20, 3) (" %7d %s Entries read so far.\n", rb->counts.scancount, rb->sd->path); - if (!storeUfsDirValidFileno(SD, s.swap_filen)) { + if (!storeUfsDirValidFileno(SD, s.swap_filen, 0)) { rb->counts.invalid++; continue; } @@ -1140,7 +1140,7 @@ storeUfsDirClean(int swap_index) if (sscanf(de->d_name, "%X", &swapfileno) != 1) continue; fn = swapfileno; /* XXX should remove this cruft ! */ - if (storeUfsDirValidFileno(SD, fn)) + if (storeUfsDirValidFileno(SD, fn, 1)) if (storeUfsDirMapBitTest(SD, fn)) if (storeUfsFilenoBelongsHere(fn, D0, D1, D2)) continue; @@ -1248,13 +1248,18 @@ storeUfsFilenoBelongsHere(int fn, int F0, int F1, int F2) } int -storeUfsDirValidFileno(SwapDir * SD, sfileno filn) +storeUfsDirValidFileno(SwapDir * SD, sfileno filn, int flag) { ufsinfo_t *ufsinfo = (ufsinfo_t *) SD->fsdata; if (filn < 0) return 0; - if (filn > ufsinfo->map->max_n_files) - return 0; + /* + * If flag is set it means out-of-range file number should + * be considered invalid. + */ + if (flag) + if (filn > ufsinfo->map->max_n_files) + return 0; return 1; } -- 2.47.3