Chris Lu
8 years ago
17 changed files with 104 additions and 33 deletions
-
2weed/command/backup.go
-
11weed/command/compact.go
-
4weed/command/master.go
-
4weed/command/server.go
-
8weed/server/master_server.go
-
8weed/server/master_server_handlers_admin.go
-
23weed/server/volume_server_handlers_admin.go
-
2weed/storage/disk_location.go
-
9weed/storage/needle_read_write.go
-
10weed/storage/store.go
-
4weed/storage/volume.go
-
17weed/storage/volume_create.go
-
19weed/storage/volume_create_linux.go
-
6weed/storage/volume_loading.go
-
8weed/storage/volume_vacuum.go
-
1weed/topology/allocate_volume.go
-
1weed/topology/volume_growth.go
@ -0,0 +1,17 @@ |
|||
// +build !linux
|
|||
|
|||
package storage |
|||
|
|||
import ( |
|||
"os" |
|||
|
|||
"github.com/chrislusf/seaweedfs/weed/glog" |
|||
) |
|||
|
|||
func createVolumeFile(fileName string, preallocate int64) (file *os.File, e error) { |
|||
file, e = os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) |
|||
if preallocate > 0 { |
|||
glog.V(0).Infof("Preallocated disk space for %s is not supported", fileName) |
|||
} |
|||
return file, e |
|||
} |
@ -0,0 +1,19 @@ |
|||
// +build linux
|
|||
|
|||
package storage |
|||
|
|||
import ( |
|||
"os" |
|||
"syscall" |
|||
|
|||
"github.com/chrislusf/seaweedfs/weed/glog" |
|||
) |
|||
|
|||
func createVolumeFile(fileName string, preallocate int64) (file *os.File, e error) { |
|||
file, e = os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) |
|||
if preallocate != 0 { |
|||
syscall.Fallocate(int(file.Fd()), 1, 0, preallocate) |
|||
glog.V(0).Infof("Preallocated %d bytes disk space for %s", preallocate, fileName) |
|||
} |
|||
return file, e |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue