Preconditions: f.mu must be locked.
(fr memmap.FileRange)
| 1180 | |
| 1181 | // Preconditions: f.mu must be locked. |
| 1182 | func (f *MemoryFile) incRefLocked(fr memmap.FileRange) { |
| 1183 | f.forEachChunk(fr, func(chunk *chunkInfo, chunkFR memmap.FileRange) bool { |
| 1184 | unfree := &f.unfreeSmall |
| 1185 | if chunk.huge { |
| 1186 | unfree = &f.unfreeHuge |
| 1187 | } |
| 1188 | unfree.MutateFullRange(chunkFR, func(ufseg unfreeIterator) bool { |
| 1189 | uf := ufseg.ValuePtr() |
| 1190 | if uf.refs <= 0 { |
| 1191 | panic(fmt.Sprintf("IncRef(%v) called with %d references on pages %v", fr, uf.refs, ufseg.Range())) |
| 1192 | } |
| 1193 | uf.refs++ |
| 1194 | return true |
| 1195 | }) |
| 1196 | return true |
| 1197 | }) |
| 1198 | } |
| 1199 | |
| 1200 | // DecRef implements memmap.File.DecRef. |
| 1201 | func (f *MemoryFile) DecRef(fr memmap.FileRange) { |
no test coverage detected