aboutsummaryrefslogtreecommitdiff
path: root/weed/command/compact.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/command/compact.go
parent7b6837cbc2b2c27b6acdc2c41d88cd27d0823e60 (diff)
downloadseaweedfs-ed44f12f6db7f05aba8a76f1a0ff92356c43d4b0.tar.xz
seaweedfs-ed44f12f6db7f05aba8a76f1a0ff92356c43d4b0.zip
support Fallocate on linux
Diffstat (limited to 'weed/command/compact.go')
-rw-r--r--weed/command/compact.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/command/compact.go b/weed/command/compact.go
index db11880ec..ae54db115 100644
--- a/weed/command/compact.go
+++ b/weed/command/compact.go
@@ -20,10 +20,11 @@ var cmdCompact = &Command{
}
var (
- compactVolumePath = cmdCompact.Flag.String("dir", ".", "data directory to store files")
- compactVolumeCollection = cmdCompact.Flag.String("collection", "", "volume collection name")
- compactVolumeId = cmdCompact.Flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir.")
- compactMethod = cmdCompact.Flag.Int("method", 0, "option to choose which compact method. use 0 or 1.")
+ compactVolumePath = cmdCompact.Flag.String("dir", ".", "data directory to store files")
+ compactVolumeCollection = cmdCompact.Flag.String("collection", "", "volume collection name")
+ compactVolumeId = cmdCompact.Flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir.")
+ compactMethod = cmdCompact.Flag.Int("method", 0, "option to choose which compact method. use 0 or 1.")
+ compactVolumePreallocate = cmdCompact.Flag.Int64("preallocate", 0, "preallocate volume disk space")
)
func runCompact(cmd *Command, args []string) bool {
@@ -34,7 +35,7 @@ func runCompact(cmd *Command, args []string) bool {
vid := storage.VolumeId(*compactVolumeId)
v, err := storage.NewVolume(*compactVolumePath, *compactVolumeCollection, vid,
- storage.NeedleMapInMemory, nil, nil)
+ storage.NeedleMapInMemory, nil, nil, *compactVolumePreallocate)
if err != nil {
glog.Fatalf("Load Volume [ERROR] %s\n", err)
}