[openfirmware] [commit] r2817 - ofw/fs/ext2fs

repository service svn at openfirmware.info
Wed Jan 11 09:36:50 CET 2012


Author: wmb
Date: Wed Jan 11 09:36:50 2012
New Revision: 2817
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2817

Log:
EXT2/3/4 filesystem - OLPC trac #11184 - fixed another problem with journal recovery (corruption when blocks revoked) and enabled writing by accepting more flag values.

Modified:
   ofw/fs/ext2fs/dir.fth
   ofw/fs/ext2fs/recovery.fth
   ofw/fs/ext2fs/sb.fth

Modified: ofw/fs/ext2fs/dir.fth
==============================================================================
--- ofw/fs/ext2fs/dir.fth	Wed Jan 11 02:45:49 2012	(r2816)
+++ ofw/fs/ext2fs/dir.fth	Wed Jan 11 09:36:50 2012	(r2817)
@@ -75,7 +75,18 @@
    swap c@                       ( adr len )
 ;
 
-: +link-count  ( increment -- )  link-count + link-count!  ;
+: +link-count  ( increment -- )
+   \ link-count = 1 means that the directory has more links than can
+   \ be represented in a 16-bit number
+   link-count 1 =  if  drop exit  then  \ Don't increment if already 1
+
+   \ If the incremented value exceeds the limit, store 1
+   \ We should also set the RO_COMPAT_DIR_NLINK bit in the superblock,
+   \ but we assume that OFW won't really be used to create enormous directories
+   link-count +  dup d# 65000 >=  if  drop 1  then  ( link-count )
+
+   link-count!
+;
 
 : new-inode    ( mode -- inode# )
    alloc-inode set-inode        ( mode )   \ alloc-inode erases the inode

Modified: ofw/fs/ext2fs/recovery.fth
==============================================================================
--- ofw/fs/ext2fs/recovery.fth	Wed Jan 11 02:45:49 2012	(r2816)
+++ ofw/fs/ext2fs/recovery.fth	Wed Jan 11 09:36:50 2012	(r2817)
@@ -277,6 +277,7 @@
    then                                ( d.block# )
    2dup revoked?  if                   ( d.block# )
       2drop                            ( )
+      log-block++ drop                 ( )
    else                                ( d.block# )
       tagp >t_flags be-l@ 1 and        ( d.block# escaped? )
       j-read-only?  if                 ( d.block# escaped? )
@@ -411,18 +412,22 @@
    read-journal  if  exit  then
 
 ." Recovering from journal ... "
+   0 to end-transaction
 
-   0 ['] one-pass catch  if
+   0 ['] one-pass catch  ?dup  if
+      .error
       ." Journal scan failed" cr
       free-journal exit
    then
 
-   1 ['] one-pass catch  if
+   1 ['] one-pass catch  ?dup  if
+      .error
       ." Journal revoke failed" cr
       free-revoke-list  free-journal  exit
    then
 
-   2 ['] one-pass catch  if
+   2 ['] one-pass catch  ?dup  if
+      .error
       ." Journal replay failed" cr
       free-overlay-list free-revoke-list  free-journal  exit
    then

Modified: ofw/fs/ext2fs/sb.fth
==============================================================================
--- ofw/fs/ext2fs/sb.fth	Wed Jan 11 02:45:49 2012	(r2816)
+++ ofw/fs/ext2fs/sb.fth	Wed Jan 11 09:36:50 2012	(r2817)
@@ -61,8 +61,8 @@
 \ Don't write to a disk that uses extensions we don't understand
 : unknown-extensions?   ( -- unsafe? )
    compat-flags   h# ffffffff invert and        \ Accept all compat extensions
-   incompat-flags h# 00000002 invert and  or    \ Incompatible - accept FILETYPE
-   ro-flags       h# 00000003 invert and  or    \ RO - accept SPARSE_SUPER and LARGE_FILE
+   incompat-flags h# 00000002 invert and  or    \ Incompatible - accept FILETYPE, EXTENTS, FLEX_BG
+   ro-flags       h# 00000073 invert and  or    \ RO - accept SPARSE_SUPER, LARGE_FILE, GDT_CSUM, DIR_NLINK, EXTRA_ISIZE
 ;
 : 'sb-uuid  ( -- adr )  super-block h# 68 +  ;
 variable le-group



More information about the openfirmware mailing list