aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_loading.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2017-01-08 11:01:46 -0800
committerChris Lu <chris.lu@gmail.com>2017-01-08 11:01:46 -0800
commited44f12f6db7f05aba8a76f1a0ff92356c43d4b0 (patch)
treee4c444173b30053d83b9a0b9ad9d8e2063f44c14 /weed/storage/volume_loading.go
parent7b6837cbc2b2c27b6acdc2c41d88cd27d0823e60 (diff)
downloadseaweedfs-ed44f12f6db7f05aba8a76f1a0ff92356c43d4b0.tar.xz
seaweedfs-ed44f12f6db7f05aba8a76f1a0ff92356c43d4b0.zip
support Fallocate on linux
Diffstat (limited to 'weed/storage/volume_loading.go')
-rw-r--r--weed/storage/volume_loading.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go
index 7bc65a4a3..c4f1aae9b 100644
--- a/weed/storage/volume_loading.go
+++ b/weed/storage/volume_loading.go
@@ -12,11 +12,11 @@ func loadVolumeWithoutIndex(dirname string, collection string, id VolumeId, need
v = &Volume{dir: dirname, Collection: collection, Id: id}
v.SuperBlock = SuperBlock{}
v.needleMapKind = needleMapKind
- e = v.load(false, false, needleMapKind)
+ e = v.load(false, false, needleMapKind, 0)
return
}
-func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind NeedleMapType) error {
+func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind NeedleMapType, preallocate int64) error {
var e error
fileName := v.FileName()
@@ -34,7 +34,7 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
}
} else {
if createDatIfMissing {
- v.dataFile, e = os.OpenFile(fileName+".dat", os.O_RDWR|os.O_CREATE, 0644)
+ v.dataFile, e = createVolumeFile(fileName+".dat", preallocate)
} else {
return fmt.Errorf("Volume Data file %s.dat does not exist.", fileName)
}