@Override
    public void open(CapacityReader reader) throws IOException {
        if (!isBlockDevice(path)) {
            openAndCheckFile();
        } else {
            try {
                long capacity = WALUtil.getBlockDeviceCapacity(path);
                if (!recoveryMode && capacityWant > capacity) {
                    // the real capacity of the block device is smaller than requested
                    throw new WALCapacityMismatchException(path, capacityWant, capacity);
                }
            } catch (ExecutionException e) {
                LOGGER.warn("failed to get the real capacity of the block device {}, just skip checking", path, e);
            }
            // We could not get the real capacity of the WAL in block device, so we just use the `capacityWant` as the capacity here
            // It will be checked and updated in `checkCapacity` later
            capacityFact = capacityWant;
        }

        randomAccessFile = new DirectRandomAccessFile(new File(path), "rw");

        checkCapacity(reader);
    }
Try to open a file with O_DIRECT flag to check whether the file system supports O_DIRECT.
The file will be deleted after the test.

@return null if the file is opened successfully, otherwise the reason why it's not available
s3stream/src/main/java/com/automq/stream/s3/wal/util/WALBlockDeviceChannel.java