mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 08:46:54 +08:00
[master] refactor HasGrowRequest to atomic bool (#5782)
refactor HasGrowRequest to atomit bool
This commit is contained in:
committed by
GitHub
parent
feb911a0b4
commit
a53e406c99
@@ -106,7 +106,7 @@ func (v *volumesBinaryState) copyState(list *VolumeLocationList) copyState {
|
||||
|
||||
// mapping from volume to its locations, inverted from server to volume
|
||||
type VolumeLayout struct {
|
||||
growRequestCount int32
|
||||
growRequest atomic.Bool
|
||||
rp *super_block.ReplicaPlacement
|
||||
ttl *needle.TTL
|
||||
diskType types.DiskType
|
||||
@@ -345,13 +345,13 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (vi
|
||||
}
|
||||
|
||||
func (vl *VolumeLayout) HasGrowRequest() bool {
|
||||
return atomic.LoadInt32(&vl.growRequestCount) > 0
|
||||
return vl.growRequest.Load()
|
||||
}
|
||||
func (vl *VolumeLayout) AddGrowRequest() {
|
||||
atomic.AddInt32(&vl.growRequestCount, 1)
|
||||
vl.growRequest.Store(true)
|
||||
}
|
||||
func (vl *VolumeLayout) DoneGrowRequest() {
|
||||
atomic.AddInt32(&vl.growRequestCount, -1)
|
||||
vl.growRequest.Store(false)
|
||||
}
|
||||
|
||||
func (vl *VolumeLayout) ShouldGrowVolumes(option *VolumeGrowOption) bool {
|
||||
|
||||
Reference in New Issue
Block a user