def cache_make(dev, reserved=None, force=False, block_size=None, bucket_size=None, attach=True):
    '''
    Create BCache cache on a block device.
    If blkdiscard is available the entire device will be properly cleared in advance.

    CLI example:

    .. code-block:: bash

        salt '*' bcache.cache_make sdb reserved=10% block_size=4096


    :param reserved: if dev is a full device, create a partition table with this size empty.

        .. note::
              this increases the amount of reserved space available to SSD garbage collectors,
              potentially (vastly) increasing performance
    :param block_size: Block size of the cache; defaults to devices' logical block size
    :param force: Overwrite existing BCache sets
    :param attach: Attach all existing backend devices immediately
    '''
    # TODO: multiple devs == md jbod

    # pylint: disable=too-many-return-statements
    # ---------------- Preflight checks ----------------
    cache = uuid()
    if cache:
        if not force:
            log.error('BCache cache %s is already on the system', cache)
            return False
        cache = _bdev()

    dev = _devbase(dev)
    udev = __salt__['udev.env'](dev)

    if ('ID_FS_TYPE' in udev or (udev.get('DEVTYPE', None) != 'partition' and 'ID_PART_TABLE_TYPE' in udev)) \
            and not force:
        log.error('%s already contains data, wipe first or force', dev)
        return False
    elif reserved is not None and udev.get('DEVTYPE', None) != 'disk':
        log.error('Need a partitionable blockdev for reserved to work')
        return False

    _, block, bucket = _sizes(dev)

    if bucket_size is None:
        bucket_size = bucket
        # TODO: bucket from _sizes() makes no sense
        bucket_size = False
    if block_size is None:
        block_size = block

    # ---------------- Still here, start doing destructive stuff ----------------
    if cache:
        if not stop():
            return False
        # Wipe the current cache device as well,
        # forever ruining any chance of it accidentally popping up again
        elif not _wipe(cache):
            return False

    # Can't do enough wiping
    if not _wipe(dev):
        return False

    if reserved:
        cmd = 'parted -m -s -a optimal -- ' \
              '/dev/{0} mklabel gpt mkpart bcache-reserved 1M {1} mkpart bcache {1} 100%'.format(dev, reserved)
        # if wipe was incomplete & part layout remains the same,
        # this is one condition set where udev would make it accidentally popup again
        if not _run_all(cmd, 'error', 'Error creating bcache partitions on {0}: %s'.format(dev)):
            return False
        dev = '{0}2'.format(dev)

    # ---------------- Finally, create a cache ----------------
    cmd = 'make-bcache --cache /dev/{0} --block {1} --wipe-bcache'.format(dev, block_size)

    # Actually bucket_size should always have a value, but for testing 0 is possible as well
    if bucket_size:
        cmd += ' --bucket {0}'.format(bucket_size)

    if not _run_all(cmd, 'error', 'Error creating cache {0}: %s'.format(dev)):
        return False
    elif not _wait(lambda: uuid() is not False,
                   'error', 'Cache {0} seemingly created OK, but FS did not activate'.format(dev)):
        return False

    if attach:
        return _alltrue(attach_())
    else:
        return True
Create BCache cache on a block device.
    If blkdiscard is available the entire device will be properly cleared in advance.

    CLI example:

    .. code-block:: bash

        salt '*' bcache.cache_make sdb reserved=10% block_size=4096


    :param reserved: if dev is a full device, create a partition table with this size empty.

        .. note::
              this increases the amount of reserved space available to SSD garbage collectors,
              potentially (vastly) increasing performance
    :param block_size: Block size of the cache; defaults to devices' logical block size
    :param force: Overwrite existing BCache sets
    :param attach: Attach all existing backend devices immediately