aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_super_block.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/volume_super_block.go')
-rw-r--r--weed/storage/volume_super_block.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/weed/storage/volume_super_block.go b/weed/storage/volume_super_block.go
index 2c2553666..cb34a2347 100644
--- a/weed/storage/volume_super_block.go
+++ b/weed/storage/volume_super_block.go
@@ -92,7 +92,7 @@ func (v *Volume) maybeWriteSuperBlock() error {
}
if stat.Size() == 0 {
v.SuperBlock.version = needle.CurrentVersion
- _, e = v.dataFile.Write(v.SuperBlock.Bytes())
+ _, e = v.dataFile.WriteAt(v.SuperBlock.Bytes(), 0)
if e != nil && os.IsPermission(e) {
//read-only, but zero length - recreate it!
if v.dataFile, e = os.Create(v.dataFile.Name()); e == nil {
@@ -123,11 +123,7 @@ func ReadSuperBlock(dataFile *os.File) (superBlock SuperBlock, err error) {
return
}
} else {
- if _, err = dataFile.Seek(0, 0); err != nil {
- err = fmt.Errorf("cannot seek to the beginning of %s: %v", dataFile.Name(), err)
- return
- }
- if _, e := dataFile.Read(header); e != nil {
+ if _, e := dataFile.ReadAt(header, 0); e != nil {
err = fmt.Errorf("cannot read volume %s super block: %v", dataFile.Name(), e)
return
}