aio-posix.c (8e3fb8029efaf220ab48290cdb5151c682227030) | aio-posix.c (cd0a6d2b2c3d5cbf82a868d8c6c80961bcda6db5) |
---|---|
1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 31 unchanged lines hidden (view full) --- 40 41#ifdef CONFIG_EPOLL_CREATE1 42 43/* The fd number threashold to switch to epoll */ 44#define EPOLL_ENABLE_THRESHOLD 64 45 46static void aio_epoll_disable(AioContext *ctx) 47{ | 1/* 2 * QEMU aio implementation 3 * 4 * Copyright IBM, Corp. 2008 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 31 unchanged lines hidden (view full) --- 40 41#ifdef CONFIG_EPOLL_CREATE1 42 43/* The fd number threashold to switch to epoll */ 44#define EPOLL_ENABLE_THRESHOLD 64 45 46static void aio_epoll_disable(AioContext *ctx) 47{ |
48 ctx->epoll_available = false; 49 if (!ctx->epoll_enabled) { | 48 ctx->epoll_enabled = false; 49 if (!ctx->epoll_available) { |
50 return; 51 } | 50 return; 51 } |
52 ctx->epoll_enabled = false; | 52 ctx->epoll_available = false; |
53 close(ctx->epollfd); 54} 55 56static inline int epoll_events_from_pfd(int pfd_events) 57{ 58 return (pfd_events & G_IO_IN ? EPOLLIN : 0) | 59 (pfd_events & G_IO_OUT ? EPOLLOUT : 0) | 60 (pfd_events & G_IO_HUP ? EPOLLHUP : 0) | --- 647 unchanged lines hidden (view full) --- 708 fprintf(stderr, "Failed to create epoll instance: %s", strerror(errno)); 709 ctx->epoll_available = false; 710 } else { 711 ctx->epoll_available = true; 712 } 713#endif 714} 715 | 53 close(ctx->epollfd); 54} 55 56static inline int epoll_events_from_pfd(int pfd_events) 57{ 58 return (pfd_events & G_IO_IN ? EPOLLIN : 0) | 59 (pfd_events & G_IO_OUT ? EPOLLOUT : 0) | 60 (pfd_events & G_IO_HUP ? EPOLLHUP : 0) | --- 647 unchanged lines hidden (view full) --- 708 fprintf(stderr, "Failed to create epoll instance: %s", strerror(errno)); 709 ctx->epoll_available = false; 710 } else { 711 ctx->epoll_available = true; 712 } 713#endif 714} 715 |
716void aio_context_destroy(AioContext *ctx) 717{ 718#ifdef CONFIG_EPOLL_CREATE1 719 aio_epoll_disable(ctx); 720#endif 721} 722 |
|
716void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns, 717 int64_t grow, int64_t shrink, Error **errp) 718{ 719 /* No thread synchronization here, it doesn't matter if an incorrect value 720 * is used once. 721 */ 722 ctx->poll_max_ns = max_ns; 723 ctx->poll_ns = 0; 724 ctx->poll_grow = grow; 725 ctx->poll_shrink = shrink; 726 727 aio_notify(ctx); 728} | 723void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns, 724 int64_t grow, int64_t shrink, Error **errp) 725{ 726 /* No thread synchronization here, it doesn't matter if an incorrect value 727 * is used once. 728 */ 729 ctx->poll_max_ns = max_ns; 730 ctx->poll_ns = 0; 731 ctx->poll_grow = grow; 732 ctx->poll_shrink = shrink; 733 734 aio_notify(ctx); 735} |