aboutsummaryrefslogtreecommitdiff
path: root/internal/inomap/inomap.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-05-03 20:21:11 +0200
committerJakob Unterwurzacher2020-05-03 20:21:11 +0200
commit8c9c68fb724150654721bd665cc9233c641a0ea5 (patch)
treef4e032bf93d7f2e2014d6b03c9b51ebb9ca65ca7 /internal/inomap/inomap.go
parent91f5c242a8f4527f3266c09d7f18ff997593bafa (diff)
inomap: fix spillBit not set on 2nd hit
Also add a test for this. Thanks @slackner for the comment.
Diffstat (limited to 'internal/inomap/inomap.go')
-rw-r--r--internal/inomap/inomap.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/inomap/inomap.go b/internal/inomap/inomap.go
index d3177ae..fb6faf6 100644
--- a/internal/inomap/inomap.go
+++ b/internal/inomap/inomap.go
@@ -27,6 +27,8 @@ const (
maxPassthruIno = 1<<48 - 1
// max value of 63 bit spill inode number
maxSpillIno = 1<<63 - 1
+ // bit 63 is used as the spill bit
+ spillBit = 1 << 63
)
// InoMap stores the maps using for inode number translation.
@@ -57,7 +59,7 @@ func New() *InoMap {
func (m *InoMap) spill(in QIno) (out uint64) {
out, found := m.spillMap[in]
if found {
- return out
+ return out | spillBit
}
if m.spillNext >= maxSpillIno {
log.Panicf("spillMap overflow: spillNext = 0x%x", m.spillNext)
@@ -65,7 +67,7 @@ func (m *InoMap) spill(in QIno) (out uint64) {
out = m.spillNext
m.spillNext++
m.spillMap[in] = out
- return 1<<63 | out
+ return out | spillBit
}
// Translate maps the passed-in (device, inode) pair to a unique inode number.