Patchwork [v6,12/18] block/rbd: drop qemu_rbd_aio_flush_cb()

login
register
mail settings
Submitter Stefan Hajnoczi
Date July 25, 2013, 3:18 p.m.
Message ID <1374765505-14356-13-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/261782/
State New
Headers show

Comments

Stefan Hajnoczi - July 25, 2013, 3:18 p.m.
.io_flush() is no longer called so drop qemu_rbd_aio_flush_cb().
qemu_aio_count is unused now so drop it too.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/rbd.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
Wayne Xia - July 29, 2013, 8:20 a.m.
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>

> .io_flush() is no longer called so drop qemu_rbd_aio_flush_cb().
> qemu_aio_count is unused now so drop it too.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   block/rbd.c | 14 +-------------
>   1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/block/rbd.c b/block/rbd.c
> index cb71751..71b4a0c 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -100,7 +100,6 @@ typedef struct BDRVRBDState {
>       rados_ioctx_t io_ctx;
>       rbd_image_t image;
>       char name[RBD_MAX_IMAGE_NAME_SIZE];
> -    int qemu_aio_count;
>       char *snap;
>       int event_reader_pos;
>       RADOSCB *event_rcb;
> @@ -428,19 +427,11 @@ static void qemu_rbd_aio_event_reader(void *opaque)
>               if (s->event_reader_pos == sizeof(s->event_rcb)) {
>                   s->event_reader_pos = 0;
>                   qemu_rbd_complete_aio(s->event_rcb);
> -                s->qemu_aio_count--;
>               }
>           }
>       } while (ret < 0 && errno == EINTR);
>   }
> 
> -static int qemu_rbd_aio_flush_cb(void *opaque)
> -{
> -    BDRVRBDState *s = opaque;
> -
> -    return (s->qemu_aio_count > 0);
> -}
> -
>   /* TODO Convert to fine grained options */
>   static QemuOptsList runtime_opts = {
>       .name = "rbd",
> @@ -554,7 +545,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags)
>       fcntl(s->fds[0], F_SETFL, O_NONBLOCK);
>       fcntl(s->fds[1], F_SETFL, O_NONBLOCK);
>       qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], qemu_rbd_aio_event_reader,
> -                            NULL, qemu_rbd_aio_flush_cb, s);
> +                            NULL, NULL, s);
> 
> 
>       qemu_opts_del(opts);
> @@ -741,8 +732,6 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
>       off = sector_num * BDRV_SECTOR_SIZE;
>       size = nb_sectors * BDRV_SECTOR_SIZE;
> 
> -    s->qemu_aio_count++; /* All the RADOSCB */
> -
>       rcb = g_malloc(sizeof(RADOSCB));
>       rcb->done = 0;
>       rcb->acb = acb;
> @@ -779,7 +768,6 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
> 
>   failed:
>       g_free(rcb);
> -    s->qemu_aio_count--;
>       qemu_aio_release(acb);
>       return NULL;
>   }
>

Patch

diff --git a/block/rbd.c b/block/rbd.c
index cb71751..71b4a0c 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -100,7 +100,6 @@  typedef struct BDRVRBDState {
     rados_ioctx_t io_ctx;
     rbd_image_t image;
     char name[RBD_MAX_IMAGE_NAME_SIZE];
-    int qemu_aio_count;
     char *snap;
     int event_reader_pos;
     RADOSCB *event_rcb;
@@ -428,19 +427,11 @@  static void qemu_rbd_aio_event_reader(void *opaque)
             if (s->event_reader_pos == sizeof(s->event_rcb)) {
                 s->event_reader_pos = 0;
                 qemu_rbd_complete_aio(s->event_rcb);
-                s->qemu_aio_count--;
             }
         }
     } while (ret < 0 && errno == EINTR);
 }
 
-static int qemu_rbd_aio_flush_cb(void *opaque)
-{
-    BDRVRBDState *s = opaque;
-
-    return (s->qemu_aio_count > 0);
-}
-
 /* TODO Convert to fine grained options */
 static QemuOptsList runtime_opts = {
     .name = "rbd",
@@ -554,7 +545,7 @@  static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags)
     fcntl(s->fds[0], F_SETFL, O_NONBLOCK);
     fcntl(s->fds[1], F_SETFL, O_NONBLOCK);
     qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], qemu_rbd_aio_event_reader,
-                            NULL, qemu_rbd_aio_flush_cb, s);
+                            NULL, NULL, s);
 
 
     qemu_opts_del(opts);
@@ -741,8 +732,6 @@  static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
     off = sector_num * BDRV_SECTOR_SIZE;
     size = nb_sectors * BDRV_SECTOR_SIZE;
 
-    s->qemu_aio_count++; /* All the RADOSCB */
-
     rcb = g_malloc(sizeof(RADOSCB));
     rcb->done = 0;
     rcb->acb = acb;
@@ -779,7 +768,6 @@  static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
 
 failed:
     g_free(rcb);
-    s->qemu_aio_count--;
     qemu_aio_release(acb);
     return NULL;
 }