code: func (w *SegmentWAL) createSegmentFile(name string) (*os.File, error) {
  	f, err := os.Create(name)
  	if err != nil {
  		return nil, err
  	}
  	if err = fileutil.Preallocate(f, w.segmentSize, true); err != nil {
  		return nil, err
  	}
  	// Write header metadata for new file.
  	metab := make([]byte, 8)
  	binary.BigEndian.PutUint32(metab[:4], WALMagic)
  	metab[4] = WALFormatDefault
  
  	if _, err := f.Write(metab); err != nil {
  		return nil, err
  	}
  	return f, err
  }
docs: // createSegmentFile creates a new segment file with the given name. It preallocates
  // the standard segment size if possible and writes the header.