Revision: 14463
Author: adrian.chadd
Date: Wed Mar 17 20:55:24 2010
Log: Issue a debug statement from the rebuild process itself tracking
the rebuild state.


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

Modified:
 /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_log.c

=======================================
--- /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_log.c Wed Mar 17 20:51:27 2010 +++ /branches/LUSCA_HEAD/app/ufs_rebuild/ufs_build_log.c Wed Mar 17 20:55:24 2010
@@ -46,12 +46,13 @@
 int num_invalid_objects = 0;

 static int
-rebuild_log_progress(FILE *fp, size_t s, int num_objects)
+rebuild_log_progress(store_ufs_dir_t *ufs, FILE *fp, size_t s, int num_objects)
 {
        struct stat sb;
        if (0 == fstat(fileno(fp), &sb)) {
if (! storeSwapLogPrintProgress(stdout, num_objects, (int) sb.st_size / s))
                        return 0;
+ debug(47, 1) ("ufs_rebuild: %s: %d of %d bytes read\n", ufs->path, (int) s, (int) sb.st_size);
        }
        return 1;
 }
@@ -65,7 +66,7 @@
 }

 int
-read_entry(FILE *fp, int version)
+read_entry(store_ufs_dir_t *ufs, FILE *fp, int version)
 {
        int r;
        char buf[128];
@@ -82,7 +83,7 @@
        num_objects++;

        if ((num_objects & 0xffff) == 0) {
-               if (! rebuild_log_progress(fp, rebuild_entry_size(version), 
num_objects))
+ if (! rebuild_log_progress(ufs, fp, rebuild_entry_size(version), num_objects))
                        return 0;
        }

@@ -174,13 +175,13 @@

        /* Now - loop over until eof or error */
        while (! feof(fp)) {
-               if (! read_entry(fp, version)) {
+               if (! read_entry(ufs, fp, version)) {
                        break;
                }
        }

        /* Queue a final progress update */
-       if (! rebuild_log_progress(fp, rebuild_entry_size(version), 
num_objects))
+ if (! rebuild_log_progress(ufs, fp, rebuild_entry_size(version), num_objects))
                return;

        fclose(fp);

--
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