super block reserves a couple of bits for future extension

This commit is contained in:
Chris Lu 2018-06-24 15:23:03 -07:00
parent f339e9c284
commit 7f6500ae07

View file

@ -55,8 +55,9 @@ func (s *SuperBlock) Bytes() []byte {
glog.Fatalf("cannot marshal super block extra %+v: %v", s.Extra, err)
}
extraSize := len(extraData)
if extraSize > 256*256 {
glog.Fatalf("super block extra size is %d bigger than %d: %v", extraSize, 256*256)
if extraSize > 256*256-2 {
// reserve a couple of bits for future extension
glog.Fatalf("super block extra size is %d bigger than %d: %v", extraSize, 256*256-2)
}
s.extraSize = uint16(extraSize)
util.Uint16toBytes(header[6:8], s.extraSize)