diff mbox

[4/6] Cleanup posix-aio.compat.c off all the old code.

Message ID 20101118180709.4434.26482.stgit@localhost6.localdomain6
State New
Headers show

Commit Message

Arun Bharadwaj Nov. 18, 2010, 6:07 p.m. UTC
Cleanup posix-aio.compat.c off all the old code which
is now useless after introducing the generic threadlet
infrasturcture.

Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
---
 posix-aio-compat.c |   57 +---------------------------------------------------
 1 files changed, 1 insertions(+), 56 deletions(-)

Comments

jvrao Nov. 30, 2010, 11:23 p.m. UTC | #1
On 11/18/2010 10:07 AM, Arun R Bharadwaj wrote:
> Cleanup posix-aio.compat.c off all the old code which
> is now useless after introducing the generic threadlet
> infrasturcture.
> 
> Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>

Looks good to me.

Acked-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>

> ---
>  posix-aio-compat.c |   57 +---------------------------------------------------
>  1 files changed, 1 insertions(+), 56 deletions(-)
> 
> diff --git a/posix-aio-compat.c b/posix-aio-compat.c
> index 3f3c461..eb82fa4 100644
> --- a/posix-aio-compat.c
> +++ b/posix-aio-compat.c
> @@ -70,10 +70,8 @@ struct qemu_paiocb {
>      int ev_signo;
>      off_t aio_offset;
> 
> -    QTAILQ_ENTRY(qemu_paiocb) node;
>      int aio_type;
>      ssize_t ret;
> -    int active;
>      struct qemu_paiocb *next;
> 
>      int async_context_id;
> @@ -238,19 +236,10 @@ static void threadlet_queue_init(ThreadletQueue *queue,
>      qemu_cond_init(&queue->cond);
>  }
> 
> -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
> -static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
> -static pthread_t thread_id;
> -static pthread_attr_t attr;
> -static int max_threads = 64;
> -static int cur_threads = 0;
> -static int idle_threads = 0;
> -static QTAILQ_HEAD(, qemu_paiocb) request_list;
> -
>  #ifdef CONFIG_PREADV
>  static int preadv_present = 1;
>  #else
> -static int preadv_present = 0;
> +static int preadv_present;
>  #endif
> 
>  static void die2(int err, const char *what)
> @@ -264,39 +253,6 @@ static void die(const char *what)
>      die2(errno, what);
>  }
> 
> -static void mutex_lock(pthread_mutex_t *mutex)
> -{
> -    int ret = pthread_mutex_lock(mutex);
> -    if (ret) die2(ret, "pthread_mutex_lock");
> -}
> -
> -static void mutex_unlock(pthread_mutex_t *mutex)
> -{
> -    int ret = pthread_mutex_unlock(mutex);
> -    if (ret) die2(ret, "pthread_mutex_unlock");
> -}
> -
> -static int cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
> -                           struct timespec *ts)
> -{
> -    int ret = pthread_cond_timedwait(cond, mutex, ts);
> -    if (ret && ret != ETIMEDOUT) die2(ret, "pthread_cond_timedwait");
> -    return ret;
> -}
> -
> -static void cond_signal(pthread_cond_t *cond)
> -{
> -    int ret = pthread_cond_signal(cond);
> -    if (ret) die2(ret, "pthread_cond_signal");
> -}
> -
> -static void thread_create(pthread_t *thread, pthread_attr_t *attr,
> -                          void *(*start_routine)(void*), void *arg)
> -{
> -    int ret = pthread_create(thread, attr, start_routine, arg);
> -    if (ret) die2(ret, "pthread_create");
> -}
> -
>  static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
>  {
>      int ret;
> @@ -741,7 +697,6 @@ int paio_init(void)
>      struct sigaction act;
>      PosixAioState *s;
>      int fds[2];
> -    int ret;
> 
>      if (posix_aio_state)
>          return 0;
> @@ -771,16 +726,6 @@ int paio_init(void)
>      qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush,
>          posix_aio_process_queue, s);
> 
> -    ret = pthread_attr_init(&attr);
> -    if (ret)
> -        die2(ret, "pthread_attr_init");
> -
> -    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
> -    if (ret)
> -        die2(ret, "pthread_attr_setdetachstate");
> -
> -    QTAILQ_INIT(&request_list);
> -
>      posix_aio_state = s;
>      return 0;
>  }
> 
>
diff mbox

Patch

diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 3f3c461..eb82fa4 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -70,10 +70,8 @@  struct qemu_paiocb {
     int ev_signo;
     off_t aio_offset;
 
-    QTAILQ_ENTRY(qemu_paiocb) node;
     int aio_type;
     ssize_t ret;
-    int active;
     struct qemu_paiocb *next;
 
     int async_context_id;
@@ -238,19 +236,10 @@  static void threadlet_queue_init(ThreadletQueue *queue,
     qemu_cond_init(&queue->cond);
 }
 
-static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_t thread_id;
-static pthread_attr_t attr;
-static int max_threads = 64;
-static int cur_threads = 0;
-static int idle_threads = 0;
-static QTAILQ_HEAD(, qemu_paiocb) request_list;
-
 #ifdef CONFIG_PREADV
 static int preadv_present = 1;
 #else
-static int preadv_present = 0;
+static int preadv_present;
 #endif
 
 static void die2(int err, const char *what)
@@ -264,39 +253,6 @@  static void die(const char *what)
     die2(errno, what);
 }
 
-static void mutex_lock(pthread_mutex_t *mutex)
-{
-    int ret = pthread_mutex_lock(mutex);
-    if (ret) die2(ret, "pthread_mutex_lock");
-}
-
-static void mutex_unlock(pthread_mutex_t *mutex)
-{
-    int ret = pthread_mutex_unlock(mutex);
-    if (ret) die2(ret, "pthread_mutex_unlock");
-}
-
-static int cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
-                           struct timespec *ts)
-{
-    int ret = pthread_cond_timedwait(cond, mutex, ts);
-    if (ret && ret != ETIMEDOUT) die2(ret, "pthread_cond_timedwait");
-    return ret;
-}
-
-static void cond_signal(pthread_cond_t *cond)
-{
-    int ret = pthread_cond_signal(cond);
-    if (ret) die2(ret, "pthread_cond_signal");
-}
-
-static void thread_create(pthread_t *thread, pthread_attr_t *attr,
-                          void *(*start_routine)(void*), void *arg)
-{
-    int ret = pthread_create(thread, attr, start_routine, arg);
-    if (ret) die2(ret, "pthread_create");
-}
-
 static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
 {
     int ret;
@@ -741,7 +697,6 @@  int paio_init(void)
     struct sigaction act;
     PosixAioState *s;
     int fds[2];
-    int ret;
 
     if (posix_aio_state)
         return 0;
@@ -771,16 +726,6 @@  int paio_init(void)
     qemu_aio_set_fd_handler(s->rfd, posix_aio_read, NULL, posix_aio_flush,
         posix_aio_process_queue, s);
 
-    ret = pthread_attr_init(&attr);
-    if (ret)
-        die2(ret, "pthread_attr_init");
-
-    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    if (ret)
-        die2(ret, "pthread_attr_setdetachstate");
-
-    QTAILQ_INIT(&request_list);
-
     posix_aio_state = s;
     return 0;
 }