/*
- * $Id: store_dir_aufs.cc,v 1.11 2000/10/31 23:48:17 wessels Exp $
+ * $Id: store_dir_aufs.cc,v 1.12 2000/11/01 03:35:47 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
rb->counts.invalid++;
continue;
}
- if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %7d %s Entries read so far.\n",
- rb->counts.scancount, rb->sd->path);
+ if ((++rb->counts.scancount & 0xFFF) == 0) {
+ struct stat sb;
+ if (0 == fstat(fileno(rb->log), &sb))
+ storeRebuildProgress(SD->index,
+ (int) sb.st_size / ss, rb->n_read);
+ }
if (!storeAufsDirValidFileno(SD, s.swap_filen, 0)) {
rb->counts.invalid++;
continue;
storefs->donefunc = storeAufsDirDone;
aio_state_pool = memPoolCreate("AUFS IO State data", sizeof(aiostate_t));
aio_qread_pool = memPoolCreate("AUFS Queued read data",
- sizeof(queued_read));
+ sizeof(queued_read));
aio_qwrite_pool = memPoolCreate("AUFS Queued write data",
- sizeof(queued_write));
+ sizeof(queued_write));
asyncufs_initialised = 1;
aioInit();
/*
- * $Id: store_dir_coss.cc,v 1.7 2000/11/01 03:32:03 wessels Exp $
+ * $Id: store_dir_coss.cc,v 1.8 2000/11/01 03:35:48 wessels Exp $
*
* DEBUG: section 81 Store COSS Directory Routines
* AUTHOR: Eric Stern
rb->counts.invalid++;
continue;
}
- if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %7d %s Entries read so far.\n",
- rb->counts.scancount, rb->sd->path);
+ if ((++rb->counts.scancount & 0xFFF) == 0) {
+ struct stat sb;
+ if (0 == fstat(fileno(rb->log), &sb))
+ storeRebuildProgress(SD->index,
+ (int) sb.st_size / ss, rb->n_read);
+ }
if (EBIT_TEST(s.flags, KEY_PRIVATE)) {
rb->counts.badflags++;
continue;
/*
- * $Id: store_dir_diskd.cc,v 1.22 2000/10/31 23:48:18 wessels Exp $
+ * $Id: store_dir_diskd.cc,v 1.23 2000/11/01 03:35:48 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
rb->counts.invalid++;
continue;
}
- if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %7d %s Entries read so far.\n",
- rb->counts.scancount, rb->sd->path);
+ if ((++rb->counts.scancount & 0xFFF) == 0) {
+ struct stat sb;
+ if (0 == fstat(fileno(rb->log), &sb))
+ storeRebuildProgress(SD->index,
+ (int) sb.st_size / ss, rb->n_read);
+ }
if (!storeDiskdDirValidFileno(SD, s.swap_filen, 0)) {
rb->counts.invalid++;
continue;
/*
- * $Id: store_dir_ufs.cc,v 1.11 2000/10/31 23:48:18 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.12 2000/11/01 03:35:49 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
rb->counts.invalid++;
continue;
}
- if ((++rb->counts.scancount & 0xFFFF) == 0)
- debug(20, 3) (" %7d %s Entries read so far.\n",
- rb->counts.scancount, rb->sd->path);
+ if ((++rb->counts.scancount & 0xFFF) == 0) {
+ struct stat sb;
+ if (0 == fstat(fileno(rb->log), &sb))
+ storeRebuildProgress(SD->index,
+ (int) sb.st_size / ss, rb->n_read);
+ }
if (!storeUfsDirValidFileno(SD, s.swap_filen, 0)) {
rb->counts.invalid++;
continue;
/*
- * $Id: protos.h,v 1.384 2000/10/31 23:48:14 wessels Exp $
+ * $Id: protos.h,v 1.385 2000/11/01 03:35:40 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
*/
extern void storeRebuildStart(void);
extern void storeRebuildComplete(struct _store_rebuild_data *);
+extern void storeRebuildProgress(int index, int total, int sofar);
/*
* store_swapin.c
/*
- * $Id: store_rebuild.cc,v 1.70 2000/05/03 17:15:44 adrian Exp $
+ * $Id: store_rebuild.cc,v 1.71 2000/11/01 03:35:41 wessels Exp $
*
* DEBUG: section 20 Store Rebuild Routines
* AUTHOR: Duane Wessels
static struct timeval rebuild_start;
static void storeCleanup(void *);
+typedef struct {
+ /* total number of "swap.state" entries that will be read */
+ int total;
+ /* number of entries read so far */
+ int scanned;
+} store_rebuild_progress;
+
+static store_rebuild_progress *RebuildProgress = NULL;
+
static int
storeCleanupDoubleCheck(StoreEntry * e)
{
(double) counts.objcount / (dt > 0.0 ? dt : 1.0));
debug(20, 1) ("Beginning Validation Procedure\n");
eventAdd("storeCleanup", storeCleanup, NULL, 0.0, 1);
+ xfree(RebuildProgress);
+ RebuildProgress = NULL;
}
/*
* finished rebuilding for sure. The corresponding decrement
* occurs in storeCleanup(), when it is finished.
*/
+ RebuildProgress = xcalloc(Config.cacheSwap.n_configured,
+ sizeof(store_rebuild_progress));
+}
+
+/*
+ * A fs-specific rebuild procedure periodically reports its
+ * progress.
+ */
+void
+storeRebuildProgress(int index, int total, int sofar)
+{
+ static time_t last_report = 0;
+ double n = 0.0;
+ double d = 0.0;
+ if (index < 0)
+ return;
+ if (index >= Config.cacheSwap.n_configured)
+ return;
+ if (NULL == RebuildProgress)
+ return;
+ RebuildProgress[index].total = total;
+ RebuildProgress[index].scanned = sofar;
+ if (squid_curtime - last_report < 15)
+ return;
+ for (index = 0; index < Config.cacheSwap.n_configured; index++) {
+ n += (double) RebuildProgress[index].scanned;
+ d += (double) RebuildProgress[index].total;
+ }
+ debug(20, 1) ("Store rebuilding is %4.1f%% complete\n", 100.0 * n / d);
+ last_report = squid_curtime;
}