ia64/xen-unstable

changeset 17058:c1003b9e0bb8

stubdom: optimize block io completion polling by not polling all the
time; only when some requests have completed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 14 09:23:14 2008 +0000 (2008-02-14)
parents b9b6caf06f8c
children eefd66912b65
files extras/mini-os/blkfront.c tools/ioemu/block-vbd.c
line diff
     1.1 --- a/extras/mini-os/blkfront.c	Thu Feb 14 09:22:33 2008 +0000
     1.2 +++ b/extras/mini-os/blkfront.c	Thu Feb 14 09:23:14 2008 +0000
     1.3 @@ -327,6 +327,11 @@ int blkfront_aio_poll(struct blkfront_de
     1.4      struct blkif_response *rsp;
     1.5  
     1.6  moretodo:
     1.7 +#ifdef HAVE_LIBC
     1.8 +    files[dev->fd].read = 0;
     1.9 +    mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */
    1.10 +#endif
    1.11 +
    1.12      rp = dev->ring.sring->rsp_prod;
    1.13      rmb(); /* Ensure we see queued responses up to 'rp'. */
    1.14      cons = dev->ring.rsp_cons;
     2.1 --- a/tools/ioemu/block-vbd.c	Thu Feb 14 09:22:33 2008 +0000
     2.2 +++ b/tools/ioemu/block-vbd.c	Thu Feb 14 09:23:14 2008 +0000
     2.3 @@ -67,6 +67,12 @@ static int vbd_probe(const uint8_t *buf,
     2.4      return 100;
     2.5  }
     2.6  
     2.7 +static void vbd_io_completed(void *opaque)
     2.8 +{
     2.9 +    BDRVVbdState *s = opaque;
    2.10 +    blkfront_aio_poll(s->dev);
    2.11 +}
    2.12 +
    2.13  static int vbd_open(BlockDriverState *bs, const char *filename, int flags)
    2.14  {
    2.15      BDRVVbdState *s = bs->opaque;
    2.16 @@ -85,6 +91,7 @@ static int vbd_open(BlockDriverState *bs
    2.17      }
    2.18  
    2.19      s->fd = blkfront_open(s->dev);
    2.20 +    qemu_set_fd_handler(s->fd, vbd_io_completed, NULL, s);
    2.21  
    2.22      QEMU_LIST_INSERT_HEAD(&vbds, s, list);
    2.23  
    2.24 @@ -102,9 +109,6 @@ void qemu_aio_init(void)
    2.25  
    2.26  void qemu_aio_poll(void)
    2.27  {
    2.28 -    BDRVVbdState *s;
    2.29 -    for (s = vbds.lh_first; s; s = s->list.le_next)
    2.30 -	blkfront_aio_poll(s->dev);
    2.31  }
    2.32  
    2.33  /* Wait for all IO requests to complete.  */