You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

439 lines
11 KiB

6 years ago
6 years ago
6 years ago
6 years ago
4 years ago
6 years ago
adding locking to avoid nil VolumeLocationList fix panic: runtime error: invalid memory address or nil pointer dereference Oct 22 00:53:44 bedb-master1 weed[8055]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x17658da] Oct 22 00:53:44 bedb-master1 weed[8055]: goroutine 310 [running]: Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLocationList).Length(...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_location_list.go:35 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLayout).enoughCopies(...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_layout.go:376 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLayout).ensureCorrectWritables(0xc000111d50, 0xc000b55438) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_layout.go:202 +0x5a Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*Topology).SyncDataNodeRegistration(0xc00042ac60, 0xc001454d30, 0x1, 0x1, 0xc0005fc000, 0xc00135de40, 0x4, 0xc00135de50, 0x10, 0x10d, ...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/topology.go:224 +0x616 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/server.(*MasterServer).SendHeartbeat(0xc000162700, 0x23b97c0, 0xc000ae2c90, 0x0, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/server/master_grpc_server.go:106 +0x325 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/pb/master_pb._Seaweed_SendHeartbeat_Handler(0x1f8e7c0, 0xc000162700, 0x23b0a60, 0xc00024b440, 0x3172c38, 0xc000ab7100) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/pb/master_pb/master.pb.go:4250 +0xad Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).processStreamingRPC(0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100, 0xc0001fea80, 0x311fec0, 0x0, 0x0, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:1329 +0xcd8 Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).handleStream(0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:1409 +0xc5c Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0001ce8b0, 0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:746 +0xa5 Oct 22 00:53:44 bedb-master1 weed[8055]: created by google.golang.org/grpc.(*Server).serveStreams.func1 Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:744 +0xa5 Oct 22 00:53:44 bedb-master1 systemd[1]: weedmaster.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Oct 22 00:53:44 bedb-master1 systemd[1]: weedmaster.service: Failed with result 'exit-code'.
4 years ago
adding locking to avoid nil VolumeLocationList fix panic: runtime error: invalid memory address or nil pointer dereference Oct 22 00:53:44 bedb-master1 weed[8055]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x17658da] Oct 22 00:53:44 bedb-master1 weed[8055]: goroutine 310 [running]: Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLocationList).Length(...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_location_list.go:35 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLayout).enoughCopies(...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_layout.go:376 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*VolumeLayout).ensureCorrectWritables(0xc000111d50, 0xc000b55438) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/volume_layout.go:202 +0x5a Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/topology.(*Topology).SyncDataNodeRegistration(0xc00042ac60, 0xc001454d30, 0x1, 0x1, 0xc0005fc000, 0xc00135de40, 0x4, 0xc00135de50, 0x10, 0x10d, ...) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/topology/topology.go:224 +0x616 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/server.(*MasterServer).SendHeartbeat(0xc000162700, 0x23b97c0, 0xc000ae2c90, 0x0, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/server/master_grpc_server.go:106 +0x325 Oct 22 00:53:44 bedb-master1 weed[8055]: github.com/chrislusf/seaweedfs/weed/pb/master_pb._Seaweed_SendHeartbeat_Handler(0x1f8e7c0, 0xc000162700, 0x23b0a60, 0xc00024b440, 0x3172c38, 0xc000ab7100) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/seaweedfs/weed/pb/master_pb/master.pb.go:4250 +0xad Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).processStreamingRPC(0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100, 0xc0001fea80, 0x311fec0, 0x0, 0x0, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:1329 +0xcd8 Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).handleStream(0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100, 0x0) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:1409 +0xc5c Oct 22 00:53:44 bedb-master1 weed[8055]: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0001ce8b0, 0xc0001f31e0, 0x23bb800, 0xc000ac5500, 0xc000ab7100) Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:746 +0xa5 Oct 22 00:53:44 bedb-master1 weed[8055]: created by google.golang.org/grpc.(*Server).serveStreams.func1 Oct 22 00:53:44 bedb-master1 weed[8055]: #011/root/go/pkg/mod/google.golang.org/grpc@v1.29.1/server.go:744 +0xa5 Oct 22 00:53:44 bedb-master1 systemd[1]: weedmaster.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Oct 22 00:53:44 bedb-master1 systemd[1]: weedmaster.service: Failed with result 'exit-code'.
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. package topology
  2. import (
  3. "errors"
  4. "fmt"
  5. "math/rand"
  6. "sync"
  7. "time"
  8. "github.com/chrislusf/seaweedfs/weed/glog"
  9. "github.com/chrislusf/seaweedfs/weed/storage"
  10. "github.com/chrislusf/seaweedfs/weed/storage/needle"
  11. "github.com/chrislusf/seaweedfs/weed/storage/super_block"
  12. )
  13. type copyState int
  14. const (
  15. noCopies copyState = 0 + iota
  16. insufficientCopies
  17. enoughCopies
  18. )
  19. type volumeState string
  20. const (
  21. readOnlyState volumeState = "ReadOnly"
  22. oversizedState = "Oversized"
  23. )
  24. type stateIndicator func(copyState) bool
  25. func ExistCopies() stateIndicator {
  26. return func(state copyState) bool { return state != noCopies }
  27. }
  28. func NoCopies() stateIndicator {
  29. return func(state copyState) bool { return state == noCopies }
  30. }
  31. type volumesBinaryState struct {
  32. rp *super_block.ReplicaPlacement
  33. name volumeState // the name for volume state (eg. "Readonly", "Oversized")
  34. indicator stateIndicator // indicate whether the volumes should be marked as `name`
  35. copyMap map[needle.VolumeId]*VolumeLocationList
  36. }
  37. func NewVolumesBinaryState(name volumeState, rp *super_block.ReplicaPlacement, indicator stateIndicator) *volumesBinaryState {
  38. return &volumesBinaryState{
  39. rp: rp,
  40. name: name,
  41. indicator: indicator,
  42. copyMap: make(map[needle.VolumeId]*VolumeLocationList),
  43. }
  44. }
  45. func (v *volumesBinaryState) Dump() (res []uint32) {
  46. for vid, list := range v.copyMap {
  47. if v.indicator(v.copyState(list)) {
  48. res = append(res, uint32(vid))
  49. }
  50. }
  51. return
  52. }
  53. func (v *volumesBinaryState) IsTrue(vid needle.VolumeId) bool {
  54. list, _ := v.copyMap[vid]
  55. return v.indicator(v.copyState(list))
  56. }
  57. func (v *volumesBinaryState) Add(vid needle.VolumeId, dn *DataNode) {
  58. list, _ := v.copyMap[vid]
  59. if list != nil {
  60. list.Set(dn)
  61. return
  62. }
  63. list = NewVolumeLocationList()
  64. list.Set(dn)
  65. v.copyMap[vid] = list
  66. }
  67. func (v *volumesBinaryState) Remove(vid needle.VolumeId, dn *DataNode) {
  68. list, _ := v.copyMap[vid]
  69. if list != nil {
  70. list.Remove(dn)
  71. if list.Length() == 0 {
  72. delete(v.copyMap, vid)
  73. }
  74. }
  75. }
  76. func (v *volumesBinaryState) copyState(list *VolumeLocationList) copyState {
  77. if list == nil {
  78. return noCopies
  79. }
  80. if list.Length() < v.rp.GetCopyCount() {
  81. return insufficientCopies
  82. }
  83. return enoughCopies
  84. }
  85. // mapping from volume to its locations, inverted from server to volume
  86. type VolumeLayout struct {
  87. rp *super_block.ReplicaPlacement
  88. ttl *needle.TTL
  89. diskType storage.DiskType
  90. vid2location map[needle.VolumeId]*VolumeLocationList
  91. writables []needle.VolumeId // transient array of writable volume id
  92. readonlyVolumes *volumesBinaryState // readonly volumes
  93. oversizedVolumes *volumesBinaryState // oversized volumes
  94. volumeSizeLimit uint64
  95. replicationAsMin bool
  96. accessLock sync.RWMutex
  97. }
  98. type VolumeLayoutStats struct {
  99. TotalSize uint64
  100. UsedSize uint64
  101. FileCount uint64
  102. }
  103. func NewVolumeLayout(rp *super_block.ReplicaPlacement, ttl *needle.TTL, diskType storage.DiskType, volumeSizeLimit uint64, replicationAsMin bool) *VolumeLayout {
  104. return &VolumeLayout{
  105. rp: rp,
  106. ttl: ttl,
  107. diskType: diskType,
  108. vid2location: make(map[needle.VolumeId]*VolumeLocationList),
  109. writables: *new([]needle.VolumeId),
  110. readonlyVolumes: NewVolumesBinaryState(readOnlyState, rp, ExistCopies()),
  111. oversizedVolumes: NewVolumesBinaryState(oversizedState, rp, ExistCopies()),
  112. volumeSizeLimit: volumeSizeLimit,
  113. replicationAsMin: replicationAsMin,
  114. }
  115. }
  116. func (vl *VolumeLayout) String() string {
  117. vl.accessLock.RLock()
  118. defer vl.accessLock.RUnlock()
  119. return fmt.Sprintf("rp:%v, ttl:%v, vid2location:%v, writables:%v, volumeSizeLimit:%v", vl.rp, vl.ttl, vl.vid2location, vl.writables, vl.volumeSizeLimit)
  120. }
  121. func (vl *VolumeLayout) RegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
  122. vl.accessLock.Lock()
  123. defer vl.accessLock.Unlock()
  124. defer vl.rememberOversizedVolume(v, dn)
  125. if _, ok := vl.vid2location[v.Id]; !ok {
  126. vl.vid2location[v.Id] = NewVolumeLocationList()
  127. }
  128. vl.vid2location[v.Id].Set(dn)
  129. // glog.V(4).Infof("volume %d added to %s len %d copy %d", v.Id, dn.Id(), vl.vid2location[v.Id].Length(), v.ReplicaPlacement.GetCopyCount())
  130. for _, dn := range vl.vid2location[v.Id].list {
  131. if vInfo, err := dn.GetVolumesById(v.Id); err == nil {
  132. if vInfo.ReadOnly {
  133. glog.V(1).Infof("vid %d removed from writable", v.Id)
  134. vl.removeFromWritable(v.Id)
  135. vl.readonlyVolumes.Add(v.Id, dn)
  136. return
  137. } else {
  138. vl.readonlyVolumes.Remove(v.Id, dn)
  139. }
  140. } else {
  141. glog.V(1).Infof("vid %d removed from writable", v.Id)
  142. vl.removeFromWritable(v.Id)
  143. vl.readonlyVolumes.Remove(v.Id, dn)
  144. return
  145. }
  146. }
  147. }
  148. func (vl *VolumeLayout) rememberOversizedVolume(v *storage.VolumeInfo, dn *DataNode) {
  149. if vl.isOversized(v) {
  150. vl.oversizedVolumes.Add(v.Id, dn)
  151. } else {
  152. vl.oversizedVolumes.Remove(v.Id, dn)
  153. }
  154. }
  155. func (vl *VolumeLayout) UnRegisterVolume(v *storage.VolumeInfo, dn *DataNode) {
  156. vl.accessLock.Lock()
  157. defer vl.accessLock.Unlock()
  158. // remove from vid2location map
  159. location, ok := vl.vid2location[v.Id]
  160. if !ok {
  161. return
  162. }
  163. if location.Remove(dn) {
  164. vl.readonlyVolumes.Remove(v.Id, dn)
  165. vl.oversizedVolumes.Remove(v.Id, dn)
  166. vl.ensureCorrectWritables(v.Id)
  167. if location.Length() == 0 {
  168. delete(vl.vid2location, v.Id)
  169. }
  170. }
  171. }
  172. func (vl *VolumeLayout) EnsureCorrectWritables(v *storage.VolumeInfo) {
  173. vl.accessLock.Lock()
  174. defer vl.accessLock.Unlock()
  175. vl.ensureCorrectWritables(v.Id)
  176. }
  177. func (vl *VolumeLayout) ensureCorrectWritables(vid needle.VolumeId) {
  178. if vl.enoughCopies(vid) && vl.isAllWritable(vid) {
  179. if !vl.oversizedVolumes.IsTrue(vid) {
  180. vl.setVolumeWritable(vid)
  181. }
  182. } else {
  183. vl.removeFromWritable(vid)
  184. }
  185. }
  186. func (vl *VolumeLayout) isAllWritable(vid needle.VolumeId) bool {
  187. for _, dn := range vl.vid2location[vid].list {
  188. if v, found := dn.volumes[vid]; found {
  189. if v.ReadOnly {
  190. return false
  191. }
  192. }
  193. }
  194. return true
  195. }
  196. func (vl *VolumeLayout) isOversized(v *storage.VolumeInfo) bool {
  197. return uint64(v.Size) >= vl.volumeSizeLimit
  198. }
  199. func (vl *VolumeLayout) isWritable(v *storage.VolumeInfo) bool {
  200. return !vl.isOversized(v) &&
  201. v.Version == needle.CurrentVersion &&
  202. !v.ReadOnly
  203. }
  204. func (vl *VolumeLayout) isEmpty() bool {
  205. vl.accessLock.RLock()
  206. defer vl.accessLock.RUnlock()
  207. return len(vl.vid2location) == 0
  208. }
  209. func (vl *VolumeLayout) Lookup(vid needle.VolumeId) []*DataNode {
  210. vl.accessLock.RLock()
  211. defer vl.accessLock.RUnlock()
  212. if location := vl.vid2location[vid]; location != nil {
  213. return location.list
  214. }
  215. return nil
  216. }
  217. func (vl *VolumeLayout) ListVolumeServers() (nodes []*DataNode) {
  218. vl.accessLock.RLock()
  219. defer vl.accessLock.RUnlock()
  220. for _, location := range vl.vid2location {
  221. nodes = append(nodes, location.list...)
  222. }
  223. return
  224. }
  225. func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (*needle.VolumeId, uint64, *VolumeLocationList, error) {
  226. vl.accessLock.RLock()
  227. defer vl.accessLock.RUnlock()
  228. lenWriters := len(vl.writables)
  229. if lenWriters <= 0 {
  230. glog.V(0).Infoln("No more writable volumes!")
  231. return nil, 0, nil, errors.New("No more writable volumes!")
  232. }
  233. if option.DataCenter == "" {
  234. vid := vl.writables[rand.Intn(lenWriters)]
  235. locationList := vl.vid2location[vid]
  236. if locationList != nil {
  237. return &vid, count, locationList, nil
  238. }
  239. return nil, 0, nil, errors.New("Strangely vid " + vid.String() + " is on no machine!")
  240. }
  241. var vid needle.VolumeId
  242. var locationList *VolumeLocationList
  243. counter := 0
  244. for _, v := range vl.writables {
  245. volumeLocationList := vl.vid2location[v]
  246. for _, dn := range volumeLocationList.list {
  247. if dn.GetDataCenter().Id() == NodeId(option.DataCenter) {
  248. if option.Rack != "" && dn.GetRack().Id() != NodeId(option.Rack) {
  249. continue
  250. }
  251. if option.DataNode != "" && dn.Id() != NodeId(option.DataNode) {
  252. continue
  253. }
  254. counter++
  255. if rand.Intn(counter) < 1 {
  256. vid, locationList = v, volumeLocationList
  257. }
  258. }
  259. }
  260. }
  261. return &vid, count, locationList, nil
  262. }
  263. func (vl *VolumeLayout) GetActiveVolumeCount(option *VolumeGrowOption) int {
  264. vl.accessLock.RLock()
  265. defer vl.accessLock.RUnlock()
  266. if option.DataCenter == "" {
  267. return len(vl.writables)
  268. }
  269. counter := 0
  270. for _, v := range vl.writables {
  271. for _, dn := range vl.vid2location[v].list {
  272. if dn.GetDataCenter().Id() == NodeId(option.DataCenter) {
  273. if option.Rack != "" && dn.GetRack().Id() != NodeId(option.Rack) {
  274. continue
  275. }
  276. if option.DataNode != "" && dn.Id() != NodeId(option.DataNode) {
  277. continue
  278. }
  279. counter++
  280. }
  281. }
  282. }
  283. return counter
  284. }
  285. func (vl *VolumeLayout) removeFromWritable(vid needle.VolumeId) bool {
  286. toDeleteIndex := -1
  287. for k, id := range vl.writables {
  288. if id == vid {
  289. toDeleteIndex = k
  290. break
  291. }
  292. }
  293. if toDeleteIndex >= 0 {
  294. glog.V(0).Infoln("Volume", vid, "becomes unwritable")
  295. vl.writables = append(vl.writables[0:toDeleteIndex], vl.writables[toDeleteIndex+1:]...)
  296. return true
  297. }
  298. return false
  299. }
  300. func (vl *VolumeLayout) setVolumeWritable(vid needle.VolumeId) bool {
  301. for _, v := range vl.writables {
  302. if v == vid {
  303. return false
  304. }
  305. }
  306. glog.V(0).Infoln("Volume", vid, "becomes writable")
  307. vl.writables = append(vl.writables, vid)
  308. return true
  309. }
  310. func (vl *VolumeLayout) SetVolumeUnavailable(dn *DataNode, vid needle.VolumeId) bool {
  311. vl.accessLock.Lock()
  312. defer vl.accessLock.Unlock()
  313. if location, ok := vl.vid2location[vid]; ok {
  314. if location.Remove(dn) {
  315. vl.readonlyVolumes.Remove(vid, dn)
  316. vl.oversizedVolumes.Remove(vid, dn)
  317. if location.Length() < vl.rp.GetCopyCount() {
  318. glog.V(0).Infoln("Volume", vid, "has", location.Length(), "replica, less than required", vl.rp.GetCopyCount())
  319. return vl.removeFromWritable(vid)
  320. }
  321. }
  322. }
  323. return false
  324. }
  325. func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid needle.VolumeId, isReadOnly bool) bool {
  326. vl.accessLock.Lock()
  327. defer vl.accessLock.Unlock()
  328. vInfo, err := dn.GetVolumesById(vid)
  329. if err != nil {
  330. return false
  331. }
  332. vl.vid2location[vid].Set(dn)
  333. if vInfo.ReadOnly || isReadOnly {
  334. return false
  335. }
  336. if vl.enoughCopies(vid) {
  337. return vl.setVolumeWritable(vid)
  338. }
  339. return false
  340. }
  341. func (vl *VolumeLayout) enoughCopies(vid needle.VolumeId) bool {
  342. locations := vl.vid2location[vid].Length()
  343. desired := vl.rp.GetCopyCount()
  344. return locations == desired || (vl.replicationAsMin && locations > desired)
  345. }
  346. func (vl *VolumeLayout) SetVolumeCapacityFull(vid needle.VolumeId) bool {
  347. vl.accessLock.Lock()
  348. defer vl.accessLock.Unlock()
  349. // glog.V(0).Infoln("Volume", vid, "reaches full capacity.")
  350. return vl.removeFromWritable(vid)
  351. }
  352. func (vl *VolumeLayout) ToMap() map[string]interface{} {
  353. m := make(map[string]interface{})
  354. m["replication"] = vl.rp.String()
  355. m["ttl"] = vl.ttl.String()
  356. m["writables"] = vl.writables
  357. //m["locations"] = vl.vid2location
  358. return m
  359. }
  360. func (vl *VolumeLayout) Stats() *VolumeLayoutStats {
  361. vl.accessLock.RLock()
  362. defer vl.accessLock.RUnlock()
  363. ret := &VolumeLayoutStats{}
  364. freshThreshold := time.Now().Unix() - 60
  365. for vid, vll := range vl.vid2location {
  366. size, fileCount := vll.Stats(vid, freshThreshold)
  367. ret.FileCount += uint64(fileCount)
  368. ret.UsedSize += size
  369. if vl.readonlyVolumes.IsTrue(vid) {
  370. ret.TotalSize += size
  371. } else {
  372. ret.TotalSize += vl.volumeSizeLimit
  373. }
  374. }
  375. return ret
  376. }