Changeset 2645
- Timestamp:
- Oct 23, 2011 1:36:33 AM (19 months ago)
- Location:
- ofw/fs/ext2fs
- Files:
-
- 6 edited
-
ext2fs.fth (modified) (1 diff)
-
ext2test.sh (modified) (4 diffs)
-
layout.fth (modified) (1 diff)
-
methods.fth (modified) (1 diff)
-
recovery.fth (modified) (6 diffs)
-
sb.fth (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ofw/fs/ext2fs/ext2fs.fth
r1 r2645 11 11 fload ${BP}/ofw/fs/ext2fs/layout.fth 12 12 fload ${BP}/ofw/fs/ext2fs/dir.fth 13 fload ${BP}/ofw/fs/ext2fs/recovery.fth 13 14 fload ${BP}/ofw/fs/ext2fs/methods.fth 15 14 16 \ LICENSE_BEGIN 15 17 \ Copyright (c) 2006 FirmWorks -
ofw/fs/ext2fs/ext2test.sh
r2625 r2645 64 64 echo REMAKING FILE 65 65 rm -f "${DEVICE}" 66 dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=8388000 2> /dev/null #838860866 # dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=8388000 2> /dev/null #8388608 67 67 # dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=4194303 2> /dev/null 68 #dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=2097151 2> /dev/null 69 #dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=1050000 2> /dev/null 68 # dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=2097151 2> /dev/null 69 # dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=1050000 2> /dev/null 70 dd if=/dev/zero of=${DEVICE} bs=512 count=1 seek=10000 2> /dev/null # 5 MiB 70 71 chmod 666 ${DEVICE} 71 72 fi … … 124 125 #/sbin/mke2fs -n -b 4096 -q ${PARTITION} 125 126 # /sbin/mke2fs -n -j -O dir_index,^huge_file -E resize=8G -m 1 -b 4096 -q ${PARTITION} 126 /sbin/mke2fs - n -j -O dir_index -m 1 -b 1024 -q ${PARTITION}127 /sbin/mke2fs -j -O dir_index -m 1 -b 1024 -q ${PARTITION} 127 128 echo "made" 128 129 … … 134 135 echo "mounted" 135 136 136 echo -n "create test content and unmount ..."137 echo "create test content" 137 138 138 139 mkdir /mnt/boot 139 140 cp ext2test.fth /mnt/boot/olpc.fth 140 141 141 cd /mnt142 pushd /mnt 142 143 touch touched 143 144 echo hello > hello … … 152 153 mkfifo fifo 153 154 mknod node b 1 1 154 cd 155 popd 156 157 if [ ! -b ${DEVICE} ] ; then 158 echo -n "save dirty journal ..." 159 sleep 10 160 cp ${DEVICE} ${DEVICE}.dirty 161 fi 162 163 echo -n "unmount ... " 155 164 umount /mnt 165 sync 156 166 157 167 if [ ! -b ${DEVICE} ] ; then 158 168 /sbin/losetup -d ${PARTITION} 169 sync 170 mv ${DEVICE} ${DEVICE}.clean 171 cp ${DEVICE}.dirty ${DEVICE}.test 159 172 fi 160 173 -
ofw/fs/ext2fs/layout.fth
r1720 r2645 212 212 get-pblk# ( adr pblk# ) 213 213 then 214 dup h# f8 < if dup . ." attempt to destroy file system" cr abort then 214 \ This interferes with journal recovery 215 \ dup h# f8 < if dup . ." attempt to destroy file system" cr abort then 215 216 block bsize move update 216 217 ; -
ofw/fs/ext2fs/methods.fth
r1954 r2645 216 216 217 217 my-args " <NoFile>" $= if true exit then 218 219 recover? if process-journal then 218 220 219 221 \ Start out in the root directory -
ofw/fs/ext2fs/recovery.fth
r2636 r2645 7 7 constant /journal-header 8 8 9 /journal-header 10 /c field >h_chksum_type 11 /c field >h_chksum_size 12 2 /c* \ Padding 13 4 /l* field >h_chksum 14 2 /l* field >h_commit_sec 15 /l field >h_commit_nsec 16 constant /commit-header 17 18 /journal-header 19 /l field >r_count 20 constant /revoke-header 21 22 struct 23 /l field >t_blocknr 24 /l field >t_flags 25 dup constant /tag32 26 /l field >t_blocknr_high 27 constant /tag64 28 9 \ Superblock - blocktype 3 (version 1) or 4 (version 2) 29 10 /journal-header 30 11 /l field >s_blocksize … … 40 21 drop 41 22 23 \ Commit header - blocktype 2 24 /journal-header 25 /c field >h_chksum_type 26 /c field >h_chksum_size 27 2 /c* \ Padding 28 4 /l* field >h_chksum 29 2 /l* field >h_commit_sec 30 /l field >h_commit_nsec 31 constant /commit-header 32 33 \ Revoke header - blocktype 5 34 /journal-header 35 /l field >r_count 36 constant /revoke-header 37 38 \ Descriptor block - blocktype 1 - journal header followed by an array of tags 39 \ Tag - 32-bit and 64-bit forms 40 struct 41 /l field >t_blocknr 42 /l field >t_flags 43 dup constant /tag32 44 /l field >t_blocknr_high 45 constant /tag64 46 42 47 0 value j-buf 43 48 0 value j-compat … … 73 78 74 79 jsb >s_start be-l@ to j-start 75 j sb0= if80 j-start 0= if 76 81 free-journal true exit ( -- skip? ) 77 82 then … … 334 339 ; 335 340 : commit-journal ( -- ) 341 jsb >s_sequence dup be-l@ 1+ swap be-l! 336 342 0 jsb >s_start be-l! 337 343 jsb 0 write-file-block … … 341 347 read-journal if exit then 342 348 349 ." Recovering from journal ... " 350 343 351 0 ['] one-pass catch if 344 352 ." Journal scan failed" cr … … 358 366 free-revoke-list 359 367 360 \commit-journal368 commit-journal 361 369 free-journal 362 ; 370 cr 371 ; -
ofw/fs/ext2fs/sb.fth
r1739 r2645 49 49 : #groups ( -- n ) total-blocks bpg ceiling ; 50 50 51 : recover? ( -- flag ) 24 +sbl 4 and 0<> ; 52 51 53 \ Don't write to a disk that uses extensions we don't understand 52 54 : unknown-extensions? ( -- unsafe? ) 53 24 +sbl 4 and if ." ext3 journal needs recovery" cr then54 55 55 23 +sbl h# ffffffff invert and \ Accept all compat extensions 56 56 24 +sbl h# 00000002 invert and or \ Incompatible - accept FILETYPE
Note: See TracChangeset
for help on using the changeset viewer.
