Patchwork raw-posix: inline paio_ioctl into hdev_aio_ioctl

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 2, 2012, 3:14 p.m.
Message ID <1351869260-26083-1-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/196581/
State New
Headers show

Comments

Paolo Bonzini - Nov. 2, 2012, 3:14 p.m.
clang now warns about an unused function:
  CC    block/raw-posix.o
block/raw-posix.c:707:26: warning: unused function paio_ioctl
[-Wunused-function]
static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
                         ^
1 warning generated.

because the only use of paio_ioctl() is inside a #if defined(__linux__)
guard and it is static now.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/raw-posix.c | 27 ++++++++++-----------------
 1 file modificato, 10 inserzioni(+), 17 rimozioni(-)
Stefan Hajnoczi - Nov. 2, 2012, 7:40 p.m.
On Fri, Nov 2, 2012 at 4:14 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> clang now warns about an unused function:
>   CC    block/raw-posix.o
> block/raw-posix.c:707:26: warning: unused function paio_ioctl
> [-Wunused-function]
> static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
>                          ^
> 1 warning generated.
>
> because the only use of paio_ioctl() is inside a #if defined(__linux__)
> guard and it is static now.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/raw-posix.c | 27 ++++++++++-----------------
>  1 file modificato, 10 inserzioni(+), 17 rimozioni(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Stefan Hajnoczi - Nov. 19, 2012, 11:53 a.m.
On Fri, Nov 02, 2012 at 04:14:20PM +0100, Paolo Bonzini wrote:
> clang now warns about an unused function:
>   CC    block/raw-posix.o
> block/raw-posix.c:707:26: warning: unused function paio_ioctl
> [-Wunused-function]
> static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
>                          ^
> 1 warning generated.
> 
> because the only use of paio_ioctl() is inside a #if defined(__linux__)
> guard and it is static now.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block/raw-posix.c | 27 ++++++++++-----------------
>  1 file modificato, 10 inserzioni(+), 17 rimozioni(-)

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index f2f0404..488e5f5 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -704,22 +704,6 @@  static BlockDriverAIOCB *paio_submit(BlockDriverState *bs, int fd,
     return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
 }
 
-static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
-        unsigned long int req, void *buf,
-        BlockDriverCompletionFunc *cb, void *opaque)
-{
-    RawPosixAIOData *acb = g_slice_new(RawPosixAIOData);
-
-    acb->bs = bs;
-    acb->aio_type = QEMU_AIO_IOCTL;
-    acb->aio_fildes = fd;
-    acb->aio_offset = 0;
-    acb->aio_ioctl_buf = buf;
-    acb->aio_ioctl_cmd = req;
-
-    return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
-}
-
 static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs,
         int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
         BlockDriverCompletionFunc *cb, void *opaque, int type)
@@ -1342,10 +1326,19 @@  static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
         BlockDriverCompletionFunc *cb, void *opaque)
 {
     BDRVRawState *s = bs->opaque;
+    RawPosixAIOData *acb;
 
     if (fd_open(bs) < 0)
         return NULL;
-    return paio_ioctl(bs, s->fd, req, buf, cb, opaque);
+
+    acb = g_slice_new(RawPosixAIOData);
+    acb->bs = bs;
+    acb->aio_type = QEMU_AIO_IOCTL;
+    acb->aio_fildes = s->fd;
+    acb->aio_offset = 0;
+    acb->aio_ioctl_buf = buf;
+    acb->aio_ioctl_cmd = req;
+    return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
 }
 
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)