Revision: 14244
Author: adrian.chadd
Date: Fri Jul 24 00:32:02 2009
Log: This is the first step of the swap log writing logic "twist" - instead  
of walking
the store directories asking for swap entries to spit out, just walk the  
global
list and call the individual swaplog writing functions for each object.

The next step is to break up the swapdir walking into separate events which
queue writing out smaller chunks of the swaplog contents in the background.


http://code.google.com/p/lusca-cache/source/detail?r=14244

Modified:
  /playpen/LUSCA_HEAD_store_clean_log_rework/src/store_dir.c

=======================================
--- /playpen/LUSCA_HEAD_store_clean_log_rework/src/store_dir.c  Thu Jul 23  
03:04:50 2009
+++ /playpen/LUSCA_HEAD_store_clean_log_rework/src/store_dir.c  Fri Jul 24  
00:32:02 2009
@@ -435,7 +435,8 @@
      double dt;
      SwapDir *sd;
      int dirn;
-    int notdone = 1;
+    hash_link *walker = NULL;
+
      if (store_dirs_rebuilding) {
        debug(20, 1) ("Not currently OK to rewrite swap log.\n");
        debug(20, 1) ("storeDirWriteCleanLogs: Operation aborted.\n");
@@ -444,6 +445,8 @@
      debug(20, 1) ("storeDirWriteCleanLogs: Starting...\n");
      getCurrentTime();
      start = current_time;
+
+
      for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) {
        sd = &Config.cacheSwap.swapDirs[dirn];
        if (sd->log.clean.start == NULL)
@@ -453,6 +456,25 @@
            continue;
        }
      }
+
+    hash_first(store_table);
+    while ((walker = hash_next(store_table))) {
+        e = (StoreEntry *) walker;     /* This works because hash table items  
have the hash struct as their first member */
+       assert(e);
+       if (e->swap_dirn == -1)
+           continue;
+       if (! storeDirObjectIsCleanWrite(e))
+           continue;
+       sd = &Config.cacheSwap.swapDirs[e->swap_dirn];
+       (sd->log.clean.write) (sd, e);
+       if ((++n & 0xFFFF) == 0) {
+           getCurrentTime();
+           debug(20, 1) ("  %7d entries written so far.\n", n);
+       }
+    }
+    hash_last(store_table);
+
+#if 0
      while (notdone) {
        notdone = 0;
        for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) {
@@ -466,13 +488,9 @@
            if (! storeDirObjectIsCleanWrite(e))
                continue;

-           (sd->log.clean.write) (sd, e);
-           if ((++n & 0xFFFF) == 0) {
-               getCurrentTime();
-               debug(20, 1) ("  %7d entries written so far.\n", n);
-           }
        }
      }
+#endif
      /* Flush */
      for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) {
        sd = &Config.cacheSwap.swapDirs[dirn];

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to