1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-16 15:28:37 +00:00

Correct broken unaligned load/store in armv5 (#1355)

Update vendor github.com/boltdb/bolt to take care of the issue #1354.
This commit is contained in:
Damien Gaignon
2017-04-06 03:50:33 +02:00
committed by Lunny Xiao
parent d800305b34
commit a78a0266c4
19 changed files with 320 additions and 74 deletions

24
vendor/github.com/boltdb/bolt/tx.go generated vendored
View File

@@ -381,7 +381,9 @@ func (tx *Tx) Check() <-chan error {
func (tx *Tx) check(ch chan error) {
// Check if any pages are double freed.
freed := make(map[pgid]bool)
for _, id := range tx.db.freelist.all() {
all := make([]pgid, tx.db.freelist.count())
tx.db.freelist.copyall(all)
for _, id := range all {
if freed[id] {
ch <- fmt.Errorf("page %d: already freed", id)
}
@@ -473,6 +475,8 @@ func (tx *Tx) write() error {
for _, p := range tx.pages {
pages = append(pages, p)
}
// Clear out page cache early.
tx.pages = make(map[pgid]*page)
sort.Sort(pages)
// Write pages to disk in order.
@@ -517,8 +521,22 @@ func (tx *Tx) write() error {
}
}
// Clear out page cache.
tx.pages = make(map[pgid]*page)
// Put small pages back to page pool.
for _, p := range pages {
// Ignore page sizes over 1 page.
// These are allocated using make() instead of the page pool.
if int(p.overflow) != 0 {
continue
}
buf := (*[maxAllocSize]byte)(unsafe.Pointer(p))[:tx.db.pageSize]
// See https://go.googlesource.com/go/+/f03c9202c43e0abb130669852082117ca50aa9b1
for i := range buf {
buf[i] = 0
}
tx.db.pagePool.Put(buf)
}
return nil
}