[OpenBIOS] r605 - ofw/fs/fatfs

svn at openbios.org svn at openbios.org
Tue Sep 18 00:52:04 CEST 2007


Author: wmb
Date: 2007-09-18 00:52:04 +0200 (Tue, 18 Sep 2007)
New Revision: 605

Modified:
   ofw/fs/fatfs/fat.fth
Log:
FAT FS: Changed the search order for free clusters so the upward search
happens before the downward one, thus eliminating severe FAT cache
thrashing when creating large files, as with "save-nand".



Modified: ofw/fs/fatfs/fat.fth
===================================================================
--- ofw/fs/fatfs/fat.fth	2007-09-17 22:47:27 UTC (rev 604)
+++ ofw/fs/fatfs/fat.fth	2007-09-17 22:52:04 UTC (rev 605)
@@ -53,13 +53,22 @@
 \ If the FAT cache has been modified since it was last written, flush it
 \ to disk.
 
+: .sectors  ( sector# #sectors -- )
+   ."  " . ." sectors starting at " .
+;
 : ?flush-fat-cache  ( -- )
    fat-dirty w@ if
-      fat-sector @ #valid-sectors fat-cache @ write-sectors  ( err? )
-      if  "CaW ".  "FAT ".  abort  then
+      fat-sector @ #valid-sectors fat-cache @ write-sectors  ( err? )  if
+         "CaW ".  "FAT ".
+         fat-sector @  #valid-sectors  .sectors
+         abort
+      then
 
-      fat-sector @ spf l@ + #valid-sectors fat-cache @ write-sectors ( err? )
-      if  "CaW ".  ." alternate "  "FAT ".  abort  then
+      fat-sector @ spf l@ + #valid-sectors fat-cache @ write-sectors  if
+         "CaW ".  ." alternate "  "FAT ".
+         fat-sector @ spf l@ +  #valid-sectors  .sectors
+         abort
+      then
 
       false fat-dirty w!
    then
@@ -172,11 +181,12 @@
       fatc-start @ hint @  search-down  if  mark-cluster exit  then
    then
 
+   \ Search up to the end of the disk ** 10/30/90 cpt: up to last cl (1+)
+   max-cl# l@ 1+ fatc-end @  search-up    if  mark-cluster exit  then
+
    \ Search down to the beginning of the disk
    2         fatc-start @  search-down  if  mark-cluster exit  then
 
-   \ Search up to the end of the disk ** 10/30/90 cpt: up to last cl (1+)
-   max-cl# l@ 1+ fatc-end @  search-up    if  mark-cluster exit  then
    false
 ;
 : allocate-cluster  ( hint-cluster# -- false | cluster# true )




More information about the OpenBIOS mailing list