|
|||||||
VROOM - Doubling MFS Write SpeedWhen developing MFSs it is frequently necessary to check whether the record being written has changed since it was read from disk. Traditionally this is done by saving off the appropriate variables, changing the BFS code to Read from Write, and performing a direct BFS call to access the old record. Whilst this is effective it does mean that every file write needs to generate a corresponding file read, thus doubling file i/o. Developers who have taken the time to examine the !! source code generated for the ! routines will notice comments relating to the caching of records by the filing system such as 0001 IF OLD.FLAG THEN 0002 * If something cached, then ID and FILEVAR must match 0003 IF OLD.ID EQ @ID THEN 0004 IF OLD.FV EQ FILEVAR THEN When a record is read from disk, SI.MFS caches it in the labelled common area %%SI%%, in the variable OLD.REC. The documented structure of %%SI%% is as follows 0001 COMMON /%%SI%%/ A,B,C,D, OLD.REC, OLD.FLAG, OLD.FV, OLD.ID, I,J,L If OLD.FLAG is set to 0, then OLD.REC does not contain a record for some reason (possibly read failure). If it is set to 1 then OLD.REC does contain a record, but if set to 2 it does not contain a record as the record read from disk was new. To avoid the second read at the MFS level it would therefore be possible to check the OLD.FLAG, if this check is passed to compare the old id to the current id, then the old filevar to the current filevar and if all conditions pass, avoid making the extra read and just compare the values in OLD.REC. (Volume 3, Issue 9, Page 5) |
|||||||
| |||||||