DIRECTORY Rope USING[ROPE], YggEnvironment USING[DID, PageCount, PageNumber, PageRun], YggInternal USING[FileHandle]; YggFilePageMgr: CEDAR DEFINITIONS = BEGIN VMPageSet: TYPE = RECORD [ pages: LONG POINTER, pageRun: YggEnvironment.PageRun, refChunk: PRIVATE RefChunk]; nullVMPageSet: VMPageSet = [NIL, [0, 0], NIL]; RefChunk: TYPE = REF Chunk; Chunk: TYPE; ReadPages: PROCEDURE [fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun] RETURNS [vMPageSet: VMPageSet]; ReadAheadPages: PROCEDURE[fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun]; UsePages: PROCEDURE [fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun] RETURNS [vMPageSet: VMPageSet]; ReadLogPages: PROCEDURE [fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun] RETURNS [vMPageSet: VMPageSet]; ReadAheadLogPages: PROCEDURE[fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun]; UseLogPages: PROCEDURE [fileHandle: YggInternal.FileHandle, pageRun: YggEnvironment.PageRun] RETURNS [vMPageSet: VMPageSet]; ShareVMPageSet: PROCEDURE [vMPageSet: VMPageSet]; ReleaseVMPageSet: PROCEDURE [vMPageSet: VMPageSet, releaseState: ReleaseState, keep: BOOLEAN]; ReleaseState: TYPE = {writeIndividualWait, writeBatchedWait, writeIndividualNoWait, writeBatchedNoWait, clean}; DirtyReleaseState: TYPE = ReleaseState[writeIndividualWait..writeBatchedNoWait]; DirtyWaitReleaseState: TYPE = ReleaseState[writeIndividualWait..writeBatchedWait]; DirtyNoWaitReleaseState: TYPE = ReleaseState[writeIndividualNoWait..writeBatchedNoWait]; ForceOutVMPageSet: PROCEDURE [vMPageSet: VMPageSet]; ForceOutFile: PROCEDURE [fileHandle: YggInternal.FileHandle]; ForceOutEverything: PROCEDURE; Create: PROCEDURE [did: YggEnvironment.DID, filePart: Rope.ROPE, initialSize: YggEnvironment.PageCount]; Delete: PROCEDURE [fileHandle: YggInternal.FileHandle]; FileExists: PROCEDURE [fileHandle: YggInternal.FileHandle] RETURNS [fileExists: BOOLEAN]; GetSize: PROCEDURE [fileHandle: YggInternal.FileHandle] RETURNS [size: YggEnvironment.PageCount]; SetSize: PROCEDURE [fileHandle: YggInternal.FileHandle, size: YggEnvironment.PageCount]; CheckPointOccuring: PROC [checkPointEpoch: NAT _ 1, expectedSecondsToNextCheckpoint: NAT _ 300] RETURNS [oldestEpochWithDirtyUnwrittenPages: NAT _ 1]; InitializeFilePageMgr: PROCEDURE[nNormalChunksInCache: NAT _ 20, nLogChunksInCache: NAT _ 20, checkPointEpoch: NAT _ 1]; RestoreCacheToCleanState: PROCEDURE; InsufficientSpaceOnVolume: -- ABSTRACTION -- ERROR; VolumeTooFragmented: -- ABSTRACTION -- ERROR; VolumeWentOffline: -- ABSTRACTION -- ERROR; NoSuchFile: -- CALLING -- ERROR; NoSuchVolume: -- CALLING -- ERROR; PageRunArgIllegal: -- CALLING -- ERROR; PageRunExtendsPastEof: -- CALLING -- ERROR; SizeArgIllegal: -- CALLING -- ERROR; END. Edit Log Initial: Kolling: 26-Jan-82 14:13:06: defs file for the File Page Manager which sits between the rest of Alpine and Pilot. Changed by MBrown on August 16, 1982 2:10 pm Nodified: by Hauser on February 19, 1985 4:30:38 pm PST ’YggFilePageMgr.mesa Copyright c 1987, 1988 by Xerox Corporation. All rights reserved. Last edited by Kolling on January 31, 1984 2:53:13 pm PST Bob Hagmann May 13, 1988 3:20:49 pm PDT Represents a contiguous set of pages from a file. There is no guarantee that each VMPageSet (as seen by the user) will have the same number of pages; the user should use the pageRun.count field. From the client's point of view, the log procedures are like the corresponding non-log procedures. They are separate in the implementation for possible optimizations, etc. All procs taking a PageRun argument raise PageRunArgIllegal if count = 0, and raise PageRunExtendsPastEof if firstPage+count > GetSize[fileHandle] except that the ReadAhead procedures just stop and return when PageRunExtendsPastEof is encountered. No proc returns a VMPageSet with count = 0. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, PageRunExtendsPastEof, VolumeWentOffline. The first data page of the file is logical page number 0. Returns a VMPageSet containing the pages [pageRun.firstPage..pageRun.firstPage + n) of the file, where n <= pageRun.count. The choice of n is entirely up to FilePageMgr. vMPageSet.pages points to the data for pageRun.firstPage, and vMPageSet.pageRun indicates what was returned. The caller has read/write access to these pages. Increments the use count of the Chunk returned in the VMPageSet. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, VolumeWentOffline. Semantically identical to ReadPages, except that it notifies the file page manager that the indicated pages are likely to be read soon rather than waiting for them now and for its handling of PageRunExtendsPastEof. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, PageRunExtendsPastEof, VolumeWentOffline. Semantically identical to ReadPages, except that the contents of the pages given by the PageRun are undefined; the implementation may therefore avoid actually reading the pages. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, PageRunExtendsPastEof, VolumeWentOffline. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, VolumeWentOffline. errors defined in this interface: NoSuchFile, NoSuchVolume, PageRunArgIllegal, PageRunExtendsPastEof, VolumeWentOffline. errors defined in this interface: none. Increments the use count of the Chunk in the VMPageSet. errors defined in this interface: none. Indicates that the client is through with the given VMPageSet (decrements use count.) keep is a hint that the FilePageManager should try to keep these pages in its cache, as the client expects them to be reused shortly. The ReleaseState hint means: clean: client has not dirtied this page; writeBatched: will cause IO for some likely disk-contiguous pages to be bunched together; writeIndividual: the client is probably not dealing with disk-contiguous pages. The implementation is optimized for "normal" clients, not mixed modes on a file, etc. Other types of client usage and incorrect hints, such as specifying clean for a dirty page, will not result in data being lost, but are likely to degrade performance. We expect: sequential access clients to release pages with keep = FALSE and (clean or writeBatchedNoWait), random access clients to release pages with keep = TRUE and (clean or writeIndividualNoWait), the log to release pages with various options. errors defined in this interface: none. Returns when all the dirty pages in the VMPageSet have been written to the disk. Does not alter use count. errors defined in this interface: NoSuchFile, NoSuchVolume, VolumeWentOffline. Returns when all the dirty pages in this file have been written to the disk. errors defined in this interface: NoSuchVolume, VolumeWentOffline. Returns when all the dirty pages under control of the file page manager have been written to the disk. errors defined in this interface: InsufficientSpaceOnVolume, NoSuchVolume, SizeArgIllegal, VolumeTooFragmented, VolumeWentOffline. Creates a file with initialSize data pages. errors defined in this interface: NoSuchFile, NoSuchVolume, VolumeWentOffline. errors defined in this interface: NoSuchVolume, VolumeWentOffline. errors defined in this interface: NoSuchFile, NoSuchVolume, VolumeWentOffline. size does not include the leader information, only the data pages. errors defined in this interface: InsufficientSpaceOnVolume, NoSuchFile, NoSuchVolume, SizeArgIllegal, VolumeTooFragmented, VolumeWentOffline. size does not include the leader information, only the data pages. On truncation, FileInUse is raised if anything past the new eof is currently in use. errors defined in this interface: none (??). errors defined in this interface: none. errors defined in this interface: none. for debugging. Call ForceOutEverything first. Errors: Added comment about PageRunArgIllegal when count = 0, etc. Hauser, March 7, 1985 2:58:12 pm PST Added copyright. Κ)˜šœ™Icodešœ Οmœ7™B—šœ™Jšœ*™*K™'—J˜J˜JšΟk ˜ ˜Jšœžœ˜Jšœžœ&˜:šœ žœ ˜J˜J˜——JšΟnœžœž œ˜#J˜Jšž˜J˜J˜šœ žœžœ˜Jšœžœžœ˜Jšœ ˜ Jšœ žœ ˜JšœΔ™ΔJ˜—Jšœžœ žœ˜.J˜Jšœ žœžœ˜Jšœžœ˜ J˜˜Jšœ¬™¬J˜Jšœ₯™₯J˜J˜—šŸ œž œ.˜Bšœžœ˜7Jšœx™xJšœΗ™ΗJ˜J˜——šŸœž œ-˜Fšœ˜Jšœb™bJšœΦ™ΦJ˜J˜——šŸœž œ.˜Ašœžœ˜7Jšœx™xJšœ²™²J˜J˜——šŸ œž œ.˜Ešœžœ˜7Jšœy™yJ˜J˜——šŸœž œ-˜Išœ˜Jšœa™aJ˜J˜——šŸ œž œ.˜Dšœžœ˜7Jšœx™xJ˜J˜——šŸœž œ˜1Jšœ'™'Jšœ7™7J˜J˜—šŸœž œ3˜Nšœžœ˜Jšœ'™'J˜—Jšœžœ]˜oJšœžœ9˜PJšœžœ7˜RJšœžœ;˜X˜JšœΙ™ΙJ˜J˜——šŸœž œ˜4Jšœ'™'Jšœk™kJ˜J˜—šŸ œž œ&˜=JšœN™NJšœL™LJ˜J˜—šŸœž œ˜JšœB™BJšœf™fJ˜J˜—J˜šŸœž œ*žœ˜Mšœ˜Jšœ‚™‚Jšœ+™+J˜J˜——šŸœž œ&˜7JšœN™NJ˜J˜—šŸ œž œ&žœžœ˜YJšœB™BJ˜J˜—šŸœž œ&žœ˜Fšœ˜JšœN™NJšœB™BJ˜J˜——šŸœž œ+˜=šœ˜JšœŽ™ŽJšœ˜™˜J˜J˜——š Ÿœžœžœ'žœžœ&žœ˜–šœ,™,J˜J˜——šŸœž œžœ˜@šœžœžœ˜7Jšœ'™'J˜J˜——šŸœž œ˜$Jšœ'™'Jšœ.™.J˜J˜J˜—Jšœ™J˜J˜JšœΟcœžœ˜3Jšœ œžœ˜-Jšœ œžœ˜+J˜Jšœ  œžœ˜"Jšœ œžœ˜$Jšœ œžœ˜)Jšœ œžœ˜-Jšœ œžœ˜&J˜J˜Jšžœ˜˜J˜J˜—J˜zJ˜J˜,Jšœ:™:J™J˜7J˜™$K™—K™K™—…— $ε