Wait until given subvolume are completely removed from the
    filesystem after deletion.

    path
        Mount point for the filesystem

    subvolids
        List of IDs of subvolumes to wait for

    sleep
        Sleep N seconds betwenn checks (default: 1)

    CLI Example:

    .. code-block:: bash

        salt '*' btrfs.subvolume_sync /var/volumes/tmp
        salt '*' btrfs.subvolume_sync /var/volumes/tmp subvolids='[257]'

def subvolume_sync(path, subvolids=None, sleep=None):
    '''
    Wait until given subvolume are completely removed from the
    filesystem after deletion.

    path
        Mount point for the filesystem

    subvolids
        List of IDs of subvolumes to wait for

    sleep
        Sleep N seconds betwenn checks (default: 1)

    CLI Example:

    .. code-block:: bash

        salt '*' btrfs.subvolume_sync /var/volumes/tmp
        salt '*' btrfs.subvolume_sync /var/volumes/tmp subvolids='[257]'

    '''
    if subvolids and type(subvolids) is not list:
        raise CommandExecutionError('Subvolids parameter must be a list')

    cmd = ['btrfs', 'subvolume', 'sync']
    if sleep:
        cmd.extend(['-s', sleep])

    cmd.append(path)
    if subvolids:
        cmd.extend(subvolids)

    res = __salt__['cmd.run_all'](cmd)
    salt.utils.fsutils._verify_run(res)
    return True