avoid reload of 'format.json' over the network under normal conditions (#18842)

This commit is contained in:
Harshavardhana
2024-01-23 14:11:46 -08:00
committed by GitHub
parent 961f7dea82
commit 52229a21cb
11 changed files with 124 additions and 44 deletions

View File

@@ -372,8 +372,6 @@ func (s *xlStorage) IsLocal() bool {
// Retrieve location indexes.
func (s *xlStorage) GetDiskLoc() (poolIdx, setIdx, diskIdx int) {
s.RLock()
defer s.RUnlock()
// If unset, see if we can locate it.
if s.poolIndex < 0 || s.setIndex < 0 || s.diskIndex < 0 {
return getXLDiskLoc(s.diskID)
@@ -381,6 +379,12 @@ func (s *xlStorage) GetDiskLoc() (poolIdx, setIdx, diskIdx int) {
return s.poolIndex, s.setIndex, s.diskIndex
}
func (s *xlStorage) SetFormatData(b []byte) {
s.Lock()
defer s.Unlock()
s.formatData = b
}
// Set location indexes.
func (s *xlStorage) SetDiskLoc(poolIdx, setIdx, diskIdx int) {
s.poolIndex = poolIdx