Move int64s to top of struct to resolve alignment issue on ARM (#2521)
* move int64s to top of struct to resolve alignment issue on ARM
This commit is contained in:
parent
0d294103e9
commit
f06aec06fb
@ -22,9 +22,10 @@ type bandwidthdb struct {
|
||||
}
|
||||
|
||||
type bandwidthUsed struct {
|
||||
// Moved to top of struct to resolve alignment issue with atomic operations on ARM
|
||||
used int64
|
||||
mu sync.RWMutex
|
||||
usedSince time.Time
|
||||
used int64
|
||||
}
|
||||
|
||||
// Bandwidth returns table for storing bandwidth usage.
|
||||
|
@ -44,8 +44,8 @@ func newInfo(path string) (*InfoDB, error) {
|
||||
dbutil.Configure(db, mon)
|
||||
|
||||
infoDb := &InfoDB{db: db}
|
||||
infoDb.pieceinfo = pieceinfo{infoDb, spaceUsed{sync.Once{}, 0}}
|
||||
infoDb.bandwidthdb = bandwidthdb{infoDb, bandwidthUsed{sync.RWMutex{}, time.Time{}, 0}}
|
||||
infoDb.pieceinfo = pieceinfo{InfoDB: infoDb, space: spaceUsed{used: 0, once: sync.Once{}}}
|
||||
infoDb.bandwidthdb = bandwidthdb{InfoDB: infoDb, bandwidth: bandwidthUsed{used: 0, mu: sync.RWMutex{}, usedSince: time.Time{}}}
|
||||
|
||||
return infoDb, nil
|
||||
}
|
||||
@ -70,8 +70,8 @@ func NewInfoInMemory() (*InfoDB, error) {
|
||||
}))
|
||||
|
||||
infoDb := &InfoDB{db: db}
|
||||
infoDb.pieceinfo = pieceinfo{infoDb, spaceUsed{sync.Once{}, 0}}
|
||||
infoDb.bandwidthdb = bandwidthdb{infoDb, bandwidthUsed{sync.RWMutex{}, time.Time{}, 0}}
|
||||
infoDb.pieceinfo = pieceinfo{InfoDB: infoDb, space: spaceUsed{used: 0, once: sync.Once{}}}
|
||||
infoDb.bandwidthdb = bandwidthdb{InfoDB: infoDb, bandwidth: bandwidthUsed{used: 0, mu: sync.RWMutex{}, usedSince: time.Time{}}}
|
||||
|
||||
return infoDb, nil
|
||||
}
|
||||
|
@ -24,8 +24,9 @@ type pieceinfo struct {
|
||||
}
|
||||
|
||||
type spaceUsed struct {
|
||||
once sync.Once
|
||||
// Moved to top of struct to resolve alignment issue with atomic operations on ARM
|
||||
used int64
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
// PieceInfo returns database for storing piece information
|
||||
|
Loading…
Reference in New Issue
Block a user