code: public int allocateSpace(final int iSize) throws IOException {
      final int offset = getFilledUpTo();
      final int size = getFileSize();
  
      if (getFreeSpace() < iSize) {
        if (maxSize > 0 && maxSize - size < iSize)
          throw new IllegalArgumentException("Cannot enlarge file since the configured max size ("
              + OFileUtils.getSizeAsString(maxSize) + ") was reached! " + toString());
  
        // MAKE ROOM
        int newFileSize = size;
  
        if (newFileSize == 0)
          // PROBABLY HAS BEEN LOST WITH HARD KILLS
          newFileSize = DEFAULT_SIZE;
  
        // GET THE STEP SIZE IN BYTES
        int stepSizeInBytes = incrementSize > 0 ? incrementSize : -1 * size / 100 * incrementSize;
  
        // FIND THE BEST SIZE TO ALLOCATE (BASED ON INCREMENT-SIZE)
        while (newFileSize - offset <= iSize) {
          newFileSize += stepSizeInBytes;
  
          if (newFileSize == 0)
            // EMPTY FILE: ALLOCATE REQUESTED SIZE ONLY
            newFileSize = iSize;
          if (newFileSize > maxSize && maxSize > 0)
            // TOO BIG: ROUND TO THE MAXIMUM FILE SIZE
            newFileSize = maxSize;
        }
  
        setSize(newFileSize);
      }
  
      // THERE IS SPACE IN FILE: RETURN THE UPPER BOUND OFFSET AND UPDATE THE FILLED THRESHOLD
      setFilledUpTo(offset + iSize);
  
      return offset;
    }
docs: /*
  (non-Javadoc)
  
  @see com.orientechnologies.orient.core.storage.fs.OFileAAA#allocateSpace(int)