Commit 217da7fd authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'stefanha/block' into staging



* stefanha/block:
  sheepdog: pass oid directly to send_pending_req()
  sheepdog: don't update inode when create_and_write fails
  block/raw-win32: Fix compiler warnings (wrong format specifiers)
  qemu-img: report size overflow error message
  cutils: change strtosz_suffix_unit function
  virtio-blk: Return UNSUPP for unknown request types
  virtio-blk: add x-data-plane=on|off performance feature
  dataplane: add virtio-blk data plane code
  virtio-blk: restore VirtIOBlkConf->config_wce flag
  iov: add qemu_iovec_concat_iov()
  test-iov: add iov_discard_front/back() testcases
  iov: add iov_discard_front/back() to remove data
  dataplane: add Linux AIO request queue
  dataplane: add event loop
  dataplane: add virtqueue vring code
  dataplane: add host memory mapping code
  configure: add CONFIG_VIRTIO_BLK_DATA_PLANE
  raw-posix: add raw_get_aio_fd() for virtio-blk-data-plane

Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parents 9a8a5ae6 d6b1ef89
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -1776,6 +1776,40 @@ static BlockDriver bdrv_host_cdrom = {
};
#endif /* __FreeBSD__ */

#ifdef CONFIG_LINUX_AIO
/**
 * Return the file descriptor for Linux AIO
 *
 * This function is a layering violation and should be removed when it becomes
 * possible to call the block layer outside the global mutex.  It allows the
 * caller to hijack the file descriptor so I/O can be performed outside the
 * block layer.
 */
int raw_get_aio_fd(BlockDriverState *bs)
{
    BDRVRawState *s;

    if (!bs->drv) {
        return -ENOMEDIUM;
    }

    if (bs->drv == bdrv_find_format("raw")) {
        bs = bs->file;
    }

    /* raw-posix has several protocols so just check for raw_aio_readv */
    if (bs->drv->bdrv_aio_readv != raw_aio_readv) {
        return -ENOTSUP;
    }

    s = bs->opaque;
    if (!s->use_aio) {
        return -ENOTSUP;
    }
    return s->fd;
}
#endif /* CONFIG_LINUX_AIO */

static void bdrv_file_init(void)
{
    /*
+2 −2
Original line number Diff line number Diff line
@@ -314,11 +314,11 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
     */
    dwPtrLow = SetFilePointer(s->hfile, low, &high, FILE_BEGIN);
    if (dwPtrLow == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
        fprintf(stderr, "SetFilePointer error: %d\n", GetLastError());
        fprintf(stderr, "SetFilePointer error: %lu\n", GetLastError());
        return -EIO;
    }
    if (SetEndOfFile(s->hfile) == 0) {
        fprintf(stderr, "SetEndOfFile error: %d\n", GetLastError());
        fprintf(stderr, "SetEndOfFile error: %lu\n", GetLastError());
        return -EIO;
    }
    return 0;
+6 −5
Original line number Diff line number Diff line
@@ -714,16 +714,17 @@ static void coroutine_fn aio_read_response(void *opaque)
             * and max_dirty_data_idx are changed to include updated
             * index between them.
             */
            if (rsp.result == SD_RES_SUCCESS) {
                s->inode.data_vdi_id[idx] = s->inode.vdi_id;
                s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx);
                s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx);

            }
            /*
             * Some requests may be blocked because simultaneous
             * create requests are not allowed, so we search the
             * pending requests here.
             */
            send_pending_req(s, vid_to_data_oid(s->inode.vdi_id, idx));
            send_pending_req(s, aio_req->oid);
        }
        break;
    case AIOCB_READ_UDATA:
+21 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ libiscsi=""
coroutine=""
seccomp=""
glusterfs=""
virtio_blk_data_plane=""

# parse CC options first
for opt do
@@ -882,6 +883,10 @@ for opt do
  ;;
  --enable-glusterfs) glusterfs="yes"
  ;;
  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
  ;;
  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
  ;;
  *) echo "ERROR: unknown option $opt"; show_help="yes"
  ;;
  esac
@@ -2273,6 +2278,17 @@ EOF
  fi
fi

##########################################
# adjust virtio-blk-data-plane based on linux-aio

if test "$virtio_blk_data_plane" = "yes" -a \
	"$linux_aio" != "yes" ; then
  echo "Error: virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
  exit 1
elif test -z "$virtio_blk_data_plane" ; then
  virtio_blk_data_plane=$linux_aio
fi

##########################################
# attr probe

@@ -3289,6 +3305,7 @@ echo "build guest agent $guest_agent"
echo "seccomp support   $seccomp"
echo "coroutine backend $coroutine_backend"
echo "GlusterFS support $glusterfs"
echo "virtio-blk-data-plane $virtio_blk_data_plane"

if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -3634,6 +3651,10 @@ if test "$glusterfs" = "yes" ; then
  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
fi

if test "$virtio_blk_data_plane" = "yes" ; then
  echo "CONFIG_VIRTIO_BLK_DATA_PLANE=y" >> $config_host_mak
fi

# USB host support
case "$usb" in
linux)
+4 −2
Original line number Diff line number Diff line
@@ -214,12 +214,13 @@ static int64_t suffix_mul(char suffix, int64_t unit)
/*
 * Convert string to bytes, allowing either B/b for bytes, K/k for KB,
 * M/m for MB, G/g for GB or T/t for TB. End pointer will be returned
 * in *end, if not NULL. Return -1 on error.
 * in *end, if not NULL. Return -ERANGE on overflow, Return -EINVAL on
 * other error.
 */
int64_t strtosz_suffix_unit(const char *nptr, char **end,
                            const char default_suffix, int64_t unit)
{
    int64_t retval = -1;
    int64_t retval = -EINVAL;
    char *endptr;
    unsigned char c;
    int mul_required = 0;
@@ -246,6 +247,7 @@ int64_t strtosz_suffix_unit(const char *nptr, char **end,
        goto fail;
    }
    if ((val * mul >= INT64_MAX) || val < 0) {
        retval = -ERANGE;
        goto fail;
    }
    retval = val * mul;
Loading