Commit bd530bc8 authored by Simon Proven's avatar Simon Proven
Browse files

Fixed:

DoOsFunRenameBigDir to work when renaming a shared file between dirs where
the file ends up as the last object in the target dir.

SanityCheckEDiscRecord to allow idlen>15 when DiscVersion=0

GrowBigDir to round up desired size to a multiple of the disc allocation
size.

Also:

Implemented non-working code to write cache the dir buffer.  WriteCacheDir
compile switch set to FALSE in s.DebugOpts.  Don't set it to TRUE unless
I tell you it's working.

Made SortDir not attempt to sort more than 2047 entries in a dir, to
avoid it overflowing ScratchSpace.

Made SortPair do one extra shell on the sort (makes it more efficient).
parent e35c6de1
;>Version Version file for FileCore
GBLS version
version SETS "3.06"
version SETS "3.07"
GBLA Version
Version SETA 306
Version SETA 307
GBLS date
date SETS "19 Jan 1998"
date SETS "23 Jan 1998"
GBLL test_version
......
......@@ -1365,7 +1365,7 @@ GrowBigDir ROUT
; loop among Fcbs until we find that matches. if it does, then we
; then have to
; then have to adjust it
sbaddr r1, FirstFcb-FcbNext
B %FT02
......@@ -1452,7 +1452,12 @@ GrowBigDir ROUT
; only need IndDiscAdd and Len to be valid in the dummy entry.
[ F
ADD R7, R7, #262144 ; 64K allocation?
MOV R10, R7
|
MOV R10, R7 ; size wanted
]
MOV R0, LR ; old extent
MOV R11, #RandomAccessExtend
BL ClaimFreeSpace ; (R0,R3,R4,R5,R10,R11->R0,R2,R10,V)
......@@ -1466,7 +1471,10 @@ GrowBigDir ROUT
BL CritInitReadNewFs ; (->R10, R11)
BL RoundUp ; round to allocation unit
BL DiscAddToRec ; (R3->LR)
LDR R8, [LR, #BitSize] ; convert units to map bits
MOV R1, R0, LSR R8 ;
......@@ -2390,11 +2398,10 @@ DoOsFunRenameBigDir ROUT
38
; here, if child is a dir, then it's as big as needs be
LDR R1, [SP, #BigDirEntrySize] ; get term again
BL MakeBigDirSpace ;(R3-R6)
TSTS R11,#1 :SHL: 31
BEQ %FT40
; If we're here then object being renamed is shared with something else. This
; means we've got to claim new space in the destination directory for it and copy
; the renamee across.
......@@ -2411,6 +2418,9 @@ DoOsFunRenameBigDir ROUT
BLVC DefaultMoveData ;(R1-R3->R0-R4,V)
Pull "R3,R4,R11"
LDRVC R1, [SP, #BigDirEntrySize] ; get term again
BLVC MakeBigDirSpace ;(R3-R6)
LDRVC R1, [SP,#BigDirEntrySize] ;new name final component
BLVC WriteBigName ;(R1,R4,R5)
MOVVC R0, SP ;move copy of old dir entry back into new place
......@@ -2425,6 +2435,8 @@ DoOsFunRenameBigDir ROUT
B %FT45
40
LDR R1, [SP, #BigDirEntrySize] ; get term again
BL MakeBigDirSpace ;(R3-R6)
BL %BT15
45
; Renaming object between directories and its already been placed in the
......
......@@ -50,6 +50,9 @@ BigDir SETL T
GBLL DynamicMaps
DynamicMaps SETL T
GBLL WriteCacheDir
WriteCacheDir SETL F
; increased space efficiency
GBLL BigDirFix
......@@ -115,7 +118,7 @@ DebugD switch F ;Scatter buffer
DebugE switch F ;new free space map
DebugEa switch F ;new free space map random extension
DebugEx switch F ; verbose new free space map
DebugEs switch F ; debugging of SortDir use in NewClaimFree
DebugEs switch T ; debugging of SortDir use in NewClaimFree
DebugF switch F ;new free space map auto compact
DebugFx switch F ;new free space map: check for this bug
DebugG switch F ;verbose file cache
......@@ -125,13 +128,13 @@ DebugH switch F ;terse file cache
DebugI switch F ;terse FIQ claim/release
DebugJ switch F ;file cache consistency checks
DebugK switch F ;setting of Interlocks
DebugL switch T ; Mounting/Identifying/Dismounting/Verifying
DebugL switch F ; Mounting/Identifying/Dismounting/Verifying
DebugLi switch F ; Changes to DiscId information in disc records
DebugLm switch F ; matching disc agianst other records
DebugM switch F ; MultiFS extensions
DebugMt switch F ; MultiFS extensions (terse)
DebugN switch F ; Disc insertion / request for insertion thread
DebugO switch T ; MultiFS extensions - formatting SWIs
DebugO switch F ; MultiFS extensions - formatting SWIs
DebugP switch F ; Process activation/deactivation
DebugQ switch F ; *-commands
DebugR switch F ; reentrance
......@@ -140,10 +143,12 @@ Debugb switch F ; break key action updates
DebugDR switch F ; check array bounds on drive and disc record ptr calculation
DebugDL switch F ; check for data lost problems with atapi
DebugX switch F ; debug long filenames
DebugXg switch F ; debug long filenames - growin dirs
DebugX switch T ; debug long filenames
DebugXg switch T ; debug long filenames - growin dirs
DebugXm switch F ; debug long filenames - memory problems
DebugCW switch F ; debug write cacheing of dirs
GBLL ExceptionTrap
GBLL VduTrap
......
......@@ -846,6 +846,14 @@ CritBufDir a4 4 ;use when BufDir itself must be invalid
BufDir a4 4 ;currently buffered directory
& -1
[ WriteCacheDir
BufDirDirty a4 4
& 0
BufDirDirtyBit * 1
ModifiedZones a4 4
& 0
]
FirstFcb a4 4 ;link to first file control block
& -1
......
......@@ -583,7 +583,7 @@ Sort
SortPair
Push "R2-R9,LR" ;SHELL SORT TABLE
[ DebugX :LAND: {FALSE}
[ DebugX
DLINE "Input to SortPair:"
Push "R0,R1,R2,R3"
......@@ -632,6 +632,14 @@ SortPair
STMIA R4, {R5, R7}
CMPS R3,R1
BLO %BT20
MOV LR, #&2200 ; 1093*8
ADD LR, LR, #&28
CMPS R2, LR
MOVHI R2, LR
BHI %BT15
CMPS R2,#364*8
MOVHI R2,#364*8
BHI %BT15
CMPS R2,#121*8
MOVHI R2,#121*8
BHI %BT15
......@@ -646,7 +654,7 @@ SortPair
MOVHI R2,#4*8
BHS %BT15
30
[ DebugX :LAND: {FALSE}
[ DebugX
DLINE "Output from SortPair:"
Push "R0,R1,R2,R3"
......
......@@ -152,10 +152,17 @@ FindDirCommon
BVC %FT90 ;If FindDir and in cache
05
[ WriteCacheDir
CLRV
]
; GetDir or failed to FindDir in cache - cache the dir in dirbuf, keeping
; directory R3 around.
BL TryCacheDirBuf ;(R3)
[ WriteCacheDir
BVS %FT95 ;if failed to dump cached dir
]
; Different operation on find/get dir
MOVS R10,R10
BNE %FT65 ;FindDir
......@@ -503,6 +510,28 @@ TryCacheDirBuf ROUT
]
CMPS R3, #-1
BEQ %FT95 ;buffer empty
[ WriteCacheDir
; check if the dir buffer is dirty
LDR LR, BufDirDirty
TSTS LR, #BufDirDirtyBit
BEQ %FT01
[ DebugCW
DREG R3, "Writing buffered dir "
]
BL WriteDir ;if the buf dir is cached, sort it
MOV LR, #0
STR LR, BufDirDirty
BVC %FT01
STR R0, [SP]
Pull "R0-R11,PC" ;error exit when writing bufdir
01
]
[ FileCache
BL LockDirCache
]
......
......@@ -1471,15 +1471,29 @@ SectorsPerCylinder
;exit
; R8 -> table start, table end marked by pair of 0 words
; ALSO NOTE:
; if there's more entries in the dir than can be sorted in ScratchSpace,
; the function will re-run but will only sort on entries near the dir
; in the map; it will keep halfing the distance allowed (in id bits)
; from the directory.
SortDir ROUT ;BUILD TABLE
[ DebugE
DREG R3, "SortDir(",cc
DREG R5, ",",cc
DLINE ")"
]
Push "R0-R2,R4,R7,LR"
Push "R0-R2,R4,R7,R9,R10,LR"
BL DiscAddToRec ;(R3->LR)
LDRB LR, [LR, #LinkBits] ;get LinkBits
MOV R1, #1
MOV R10, R1, LSL LR ;number of possible ids
03
MOV R1, #0 ;init index in dir
MOV R8, #ScratchSpace
ADD R9, R8, #?ScratchSpace ; end of scratch space
MOV R7, R8
ANDS LR, R3, #&FF
ORRNE LR, LR, #1 :SHL: 8
......@@ -1499,20 +1513,29 @@ SortDir ROUT ;BUILD TABLE
TSTS LR, #DirBit
BNE %FT10
BL ReadIndDiscAdd ;(R3,R4->LR)
[ DebugX
DREG LR, "Indirect disc address: "
]
BIC R2, LR, #DiscBits
TEQS R2, #1 ;skip if 0 length
ANDNES R2, LR, #&FF ;or not shared
BEQ %FT10
MOV LR, LR, LSR #8 ;build entry
SUBS LR, LR, R3, LSR #8
RSBMI LR, LR, #0
RSBMI LR, LR, #0 ;offset in linkbits
ORR LR, R2, LR, LSL #9
ORRPL LR, LR, #1 :SHL: 8
CMPS LR, R10, LSL #9 ;check for too high
BHI %FT10 ;if too high then back round again
[ DebugX
DREG R1, "Dir index : "
DREG LR, "Other word : "
]
STMIA R7!, {R1, LR}
CMP R7, R9
MOVEQ R10, R10, LSR #1 ; half the search range
BEQ %BT03 ; back round with reduced search range
10
[ BigDir
BL TestBigDir
......@@ -1534,7 +1557,7 @@ SortDir ROUT ;BUILD TABLE
MOV LR, #0
STR LR, [R7],#4
STR LR, [R7],#4
Pull "R0-R2,R4,R7,PC",,^
Pull "R0-R2,R4,R7,R9,R10,PC",,^
|
......
......@@ -1577,6 +1577,22 @@ WriteFsMapThenDir ROUT
STRVS R0,[SP]
Pull "R0-R11,PC"
[ WriteCacheDir
; ======================
; WriteFsMapThenMaybeDir
; ======================
WriteFsMapThenMaybeDir ROUT
[ Debug5
DLINE "WriteFsMapThenMaybeDir"
]
Push "R0-R11,LR"
BL DisableBreak
BL CriticalWriteFsMapThenMaybeDir
BL RestoreBreak
STRVS R0,[SP]
Pull "R0-R11,PC"
]
; ===============
; InvalidateFsMap
......@@ -1726,6 +1742,11 @@ ValidateBufDir
STRNE LR, BufDir
MOV LR, #-1
STRNE LR, CritBufDir
[ WriteCacheDir
MOV LR, #0
STR LR, BufDirDirty
]
Pull "PC",,^
......
......@@ -486,6 +486,9 @@ DoOsFileCreateDir ROUT
BL ClaimFreeSpace ; (R3,R10->R0,R2,V)
BVS %FT95 ; couldn't claim free space
BL TryCacheDirBuf ; (R3) we'll create dir in the dir buffer
[ WriteCacheDir
BVS %FT95
]
Push "R1-R4"
MOV R0, R5
MOV R1, R10
......@@ -511,6 +514,9 @@ DoOsFileCreateDir ROUT
BL ClaimFreeSpace ;(R3,R10->R0,R2,V)
BVS %FT95
BL TryCacheDirBuf ;(R3) will create dir in dir buffer
[ WriteCacheDir
BVS %FT95
]
Push "R1-R4"
MOV R0, R5
MOV R1, R10
......@@ -689,7 +695,11 @@ SaveCreate ROUT
Pull "R1-R5"
BVS %FT95
40
[ WriteCacheDir
BL WriteFsMapThenMaybeDir ; (->R0,V)
|
BL WriteFsMapThenDir ;(->R0,V)
]
95
BL UnlockMap
99
......@@ -904,6 +914,17 @@ CriticalWriteFsMap ROUT
CMPS R0, R9
BLO %BT05
CMPS R3, R4
[ WriteCacheDir
; if no zones modified, store 0 in ModifiedZones
MOVGT R0, #0
MOVLE R0, #1
STR R0, ModifiedZones ; number of modified zones
[ DebugCW
DREG R0, "zones modified flag : "
]
]
BGT %FT93 ;if no zones modified
ADDLT R3, R10,R3, LSL R7 ;if more than one zone modified
......@@ -1206,6 +1227,31 @@ CriticalWriteDirThenFsMap ROUT
BL ExitCritical
[ WriteCacheDir
; ------------------------------
; CriticalWriteFsMapThenMaybeDir
; ------------------------------
CriticalWriteFsMapThenMaybeDir ROUT
StartCritical
BL CriticalWriteFsMap
LDR R0, CritResult
BL SetVOnR0
BVS %FT95
MOV R0, #BufDirDirtyBit
STR R0, BufDirDirty ; mark BufDir as dirty for now
LDR R0, ModifiedZones
TEQS R0, #0
BEQ %FT95
MOV R0, #0
STR R0, BufDirDirty
BL CriticalWriteDir
LDR R0, CritResult
BL SetVOnR0
95
BL ExitCritical
]
; -------------------------
; CriticalWriteFsMapThenDir
; -------------------------
......
......@@ -795,6 +795,11 @@ SanityCheckEDiscRecord ROUT
; Check RootDir is sensible:
; Must be &000002nn where nn=(2*Zones)>>ShareSize+1
[ BigMaps
LDRB r1, [sp, #LinkBits]
CMP r1, #15
BHI %FT10
LDRB r1, [sp, #DiscVersion]
TEQS r1, #0
BNE %FT10 ; don't sanity check rootdir address
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment