Merge pull request #705 from unihorn/61

feat: set NOCOW for log directory when in btrfs
This commit is contained in:
Xiang Li
2014-04-14 16:40:38 -04:00
7 changed files with 119 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ import (
etcdErr "github.com/coreos/etcd/error"
"github.com/coreos/etcd/log"
"github.com/coreos/etcd/metrics"
"github.com/coreos/etcd/pkg/btrfs"
"github.com/coreos/etcd/store"
)
@@ -291,6 +292,13 @@ func (s *PeerServer) Start(snapshot bool, discoverURL string, peers []string) er
s.raftServer.Init()
// Set NOCOW for data directory in btrfs
if btrfs.IsBtrfs(s.raftServer.LogPath()) {
if err := btrfs.SetNOCOWFile(s.raftServer.LogPath()); err != nil {
log.Warnf("Failed setting NOCOW: %v", err)
}
}
s.findCluster(discoverURL, peers)
s.closeChan = make(chan bool)