If some log records write across more than 2 log pages unfortunately, 
current fsck may not read log record correctly.
so. we should make fsck utility to be able to read log record correctly.
I tested it several times. and it works well.

diff -ruN jfsutils-1.1.13/libfs/log_read.c 
jfsutils-1.1.13.patched/libfs/log_read.c
--- jfsutils-1.1.13/libfs/log_read.c    2005-11-23 05:43:55.000000000 +0900
+++ jfsutils-1.1.13.patched/libfs/log_read.c    2008-08-29 
15:41:03.918875268 +0900
@@ -474,8 +474,9 @@
      * get the previous page
      */
 
-    if (words != nwords    /* we get less than nwords */
-        || j < 0) {        /* or exhaust the page, so offset is just */
+    while (words != nwords        /* we get less than nwords */
+            || j < 0) {    /* or exhaust the page, so offset is just */
+        nwords -= words;
         /* the page head, then j < 0              */
         /* get previous page */
         pno = logptr[*buf];
@@ -493,14 +494,17 @@
         *offset = LOGPSIZE - LOGPTLRSIZE;
         /* index last word of data area */
         j = LOGPSIZE / 4 - 4 - 1;
-        /* move rest of nwords if any. this will never
-           exhaust the page.                          */
-        for (n = 0; n < nwords - words; n++) {
+        /* move rest of nwords if any. */
+        for (n = 0; n < nwords; n++) {
+            if (j < 0) {
+                break;
+            }
             *ptr = logp[*buf].data[j];
             j = j - 1;
             ptr = ptr - 1;
         }
-        *offset = *offset - 4 * (nwords - words);
+        words = n;
+        *offset = *offset - 4 * nwords;
     }
 
     return (0);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to