public StorageManager(String dir, int capacityPerBlock, int initNumberOfBlocks, StorageMode storageMode, double dirtyRatioThreshold,
                long maxOffHeapMemorySize) throws IOException {
        this.dir = dir;
        this.capacityPerBlock = capacityPerBlock;
        this.dirtyRatioThreshold = dirtyRatioThreshold;
        this.storageMode = storageMode;
        if (this.storageMode != StorageMode.File) {
            this.allowedMaxOffHeapBlockCount = (int) (maxOffHeapMemorySize / capacityPerBlock);
        } else {
            this.allowedMaxOffHeapBlockCount = 0;
        }

        initBlocks(dir, initNumberOfBlocks);
    }