1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 12:38:05 +11:00

Make FLUSH also invalidate the blk cache

This commit is contained in:
Virgil Dupras 2020-12-25 16:43:20 -05:00
parent 6f4f870dd4
commit 18f6978399
3 changed files with 11 additions and 2 deletions

2
blk.fs
View File

@ -1939,7 +1939,7 @@ SYSVARS 0x0c + :** C<*
: BLK! ( -- )
BLK> @ BLK!* @ EXECUTE
0 BLKDTY ! ;
: FLUSH BLKDTY @ IF BLK! THEN ;
: FLUSH BLKDTY @ IF BLK! THEN -1 BLK> ! ;
: BLK@ ( n -- )
DUP BLK> @ = IF DROP EXIT THEN
FLUSH DUP BLK> ! BLK@* @ EXECUTE ;

View File

@ -264,7 +264,8 @@ BLK> -- a Address of the current block variable.
BLK( -- a Beginning addr of blk buf.
BLK) -- a Ending addr of blk buf.
COPY s d -- Copy contents of s block to d block.
FLUSH -- Write current block to disk if dirty.
FLUSH -- Write current block to disk if dirty and inval-
idates current block cache.
LIST n -- Prints the contents of the block n on screen
in the form of 16 lines of 64 columns.
LOAD n -- Interprets Forth code from block n

View File

@ -108,6 +108,8 @@ Many blocks contain code. That code can be interpreted through
LOAD. Programs stored in blocks frequently have "loader blocks"
that take care of loading all blocks relevant to the program.
# Spanning multiple disks
Blocks spanning multiple disks are tricky. If your media isn't
large enough to hold all Collapse OS blocks in one unit, you'll
have to make it span multiple disks. Block reference in
@ -123,6 +125,12 @@ Although the usage of absolute LOAD calls are minimally used
When you span Collapse OS over multiple disks, don't forget to
adjust those absolute LOADs.
When you work with multiple disks, you have to remember to FLUSH
before swapping the disk. This will write current block if it's
dirty and also invalidate the cache. This way, you're not at
risk of either overwriting a block on your other disk or LOADing
cached contents without noticing.
# How blocks are organized
Organization of contiguous blocks is an ongoing challenge and