aboutsummaryrefslogtreecommitdiff
path: root/weed/util/chunk_cache/on_disk_cache_layer.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/chunk_cache/on_disk_cache_layer.go')
-rw-r--r--weed/util/chunk_cache/on_disk_cache_layer.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/weed/util/chunk_cache/on_disk_cache_layer.go b/weed/util/chunk_cache/on_disk_cache_layer.go
index c3192b548..eebd89798 100644
--- a/weed/util/chunk_cache/on_disk_cache_layer.go
+++ b/weed/util/chunk_cache/on_disk_cache_layer.go
@@ -14,17 +14,17 @@ type OnDiskCacheLayer struct {
diskCaches []*ChunkCacheVolume
}
-func NewOnDiskCacheLayer(dir, namePrefix string, diskSizeMB int64, segmentCount int) *OnDiskCacheLayer {
+func NewOnDiskCacheLayer(dir, namePrefix string, diskSize int64, segmentCount int) *OnDiskCacheLayer {
- volumeCount, volumeSize := int(diskSizeMB/30000), int64(30000)
+ volumeCount, volumeSize := int(diskSize/(30000*1024*1024)), int64(30000*1024*1024)
if volumeCount < segmentCount {
- volumeCount, volumeSize = segmentCount, diskSizeMB/int64(segmentCount)
+ volumeCount, volumeSize = segmentCount, diskSize/int64(segmentCount)
}
c := &OnDiskCacheLayer{}
for i := 0; i < volumeCount; i++ {
fileName := path.Join(dir, fmt.Sprintf("%s_%d", namePrefix, i))
- diskCache, err := LoadOrCreateChunkCacheVolume(fileName, volumeSize*1024*1024)
+ diskCache, err := LoadOrCreateChunkCacheVolume(fileName, volumeSize)
if err != nil {
glog.Errorf("failed to add cache %s : %v", fileName, err)
} else {