diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-19 14:11:32 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-19 14:11:32 -0600 |
commit | 12b36fe70c3dee7f8ae9a1e2b68f76e1d9c4cd71 (patch) | |
tree | 604e58d3f0b1a6a72b9989822dcb8ff1a4c97b9e /freelist.go | |
parent | Fix freelist allocation direction. (diff) | |
download | dedo-12b36fe70c3dee7f8ae9a1e2b68f76e1d9c4cd71.tar.gz dedo-12b36fe70c3dee7f8ae9a1e2b68f76e1d9c4cd71.tar.xz |
Fix freelist allocate().
Diffstat (limited to 'freelist.go')
-rw-r--r-- | freelist.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/freelist.go b/freelist.go index 0d79bb4..149e595 100644 --- a/freelist.go +++ b/freelist.go @@ -55,7 +55,7 @@ func (f *freelist) allocate(n int) pgid { if (i + 1) == n { f.ids = f.ids[i+1:] } else { - copy(f.ids[i-1:], f.ids[i+n-1:]) + copy(f.ids[i-n+1:], f.ids[i+1:]) f.ids = f.ids[:len(f.ids)-n] } return initial @@ -111,7 +111,7 @@ func (f *freelist) read(p *page) { ids := ((*[maxAllocSize]pgid)(unsafe.Pointer(&p.ptr)))[0:p.count] f.ids = make([]pgid, len(ids)) copy(f.ids, ids) - sort.Sort(pgids(ids)) + sort.Sort(pgids(f.ids)) } // write writes the page ids onto a freelist page. All free and pending ids are |