code: func (n *node) splitIndex(threshold int) (index, sz int) {
  	sz = pageHeaderSize
  
  	// Loop until we only have the minimum number of keys required for the second page.
  	for i := 0; i < len(n.inodes)-minKeysPerPage; i++ {
  		index = i
  		inode := n.inodes[i]
  		elsize := n.pageElementSize() + len(inode.key) + len(inode.value)
  
  		// If we have at least the minimum number of keys and adding another
  		// node would put us over the threshold then exit and return.
  		if i >= minKeysPerPage && sz+elsize > threshold {
  			break
  		}
  
  		// Add the element size to the total size.
  		sz += elsize
  	}
  
  	return
  }
docs: // splitIndex finds the position where a page will fill a given threshold.
  // It returns the index as well as the size of the first page.
  // This is only be called from split().