Lines Matching full:node
40 AioHandler *node, in aio_add_ready_handler() argument
43 QLIST_SAFE_REMOVE(node, node_ready); /* remove from nested parent's list */ in aio_add_ready_handler()
44 node->pfd.revents = revents; in aio_add_ready_handler()
45 QLIST_INSERT_HEAD(ready_list, node, node_ready); in aio_add_ready_handler()
49 AioHandler *node) in aio_add_poll_ready_handler() argument
51 QLIST_SAFE_REMOVE(node, node_ready); /* remove from nested parent's list */ in aio_add_poll_ready_handler()
52 node->poll_ready = true; in aio_add_poll_ready_handler()
53 QLIST_INSERT_HEAD(ready_list, node, node_ready); in aio_add_poll_ready_handler()
58 AioHandler *node; in find_aio_handler() local
60 QLIST_FOREACH(node, &ctx->aio_handlers, node) { in find_aio_handler()
61 if (node->pfd.fd == fd) { in find_aio_handler()
62 if (!QLIST_IS_INSERTED(node, node_deleted)) { in find_aio_handler()
63 return node; in find_aio_handler()
71 static bool aio_remove_fd_handler(AioContext *ctx, AioHandler *node) in aio_remove_fd_handler() argument
79 g_source_remove_poll(&ctx->source, &node->pfd); in aio_remove_fd_handler()
82 node->pfd.revents = 0; in aio_remove_fd_handler()
83 node->poll_ready = false; in aio_remove_fd_handler()
86 if (QLIST_IS_INSERTED(node, node_deleted)) { in aio_remove_fd_handler()
90 /* If a read is in progress, just mark the node as deleted */ in aio_remove_fd_handler()
92 QLIST_INSERT_HEAD_RCU(&ctx->deleted_aio_handlers, node, node_deleted); in aio_remove_fd_handler()
99 QLIST_SAFE_REMOVE(node, node_poll); in aio_remove_fd_handler()
100 QLIST_REMOVE(node, node); in aio_remove_fd_handler()
112 AioHandler *node; in aio_set_fd_handler() local
124 node = find_aio_handler(ctx, fd); in aio_set_fd_handler()
128 if (node == NULL) { in aio_set_fd_handler()
133 node->pfd.events = 0; in aio_set_fd_handler()
135 poll_disable_change = -!node->io_poll; in aio_set_fd_handler()
137 poll_disable_change = !io_poll - (node && !node->io_poll); in aio_set_fd_handler()
138 if (node == NULL) { in aio_set_fd_handler()
154 new_node->pfd = node->pfd; in aio_set_fd_handler()
161 QLIST_INSERT_HEAD_RCU(&ctx->aio_handlers, new_node, node); in aio_set_fd_handler()
173 ctx->fdmon_ops->update(ctx, node, new_node); in aio_set_fd_handler()
174 if (node) { in aio_set_fd_handler()
175 deleted = aio_remove_fd_handler(ctx, node); in aio_set_fd_handler()
181 g_free(node); in aio_set_fd_handler()
189 AioHandler *node = find_aio_handler(ctx, fd); in aio_set_fd_poll() local
191 if (!node) { in aio_set_fd_poll()
195 node->io_poll_begin = io_poll_begin; in aio_set_fd_poll()
196 node->io_poll_end = io_poll_end; in aio_set_fd_poll()
223 AioHandler *node; in poll_set_started() local
233 QLIST_FOREACH(node, &ctx->poll_aio_handlers, node_poll) { in poll_set_started()
236 if (QLIST_IS_INSERTED(node, node_deleted)) { in poll_set_started()
241 fn = node->io_poll_begin; in poll_set_started()
243 fn = node->io_poll_end; in poll_set_started()
247 fn(node->opaque); in poll_set_started()
251 if (!started && node->io_poll(node->opaque)) { in poll_set_started()
252 aio_add_poll_ready_handler(ready_list, node); in poll_set_started()
275 AioHandler *node; in aio_pending() local
284 QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) { in aio_pending()
288 revents = node->pfd.revents & node->pfd.events; in aio_pending()
289 if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR) && node->io_read) { in aio_pending()
293 if (revents & (G_IO_OUT | G_IO_ERR) && node->io_write) { in aio_pending()
305 AioHandler *node; in aio_free_deleted_handlers() local
314 while ((node = QLIST_FIRST_RCU(&ctx->deleted_aio_handlers))) { in aio_free_deleted_handlers()
315 QLIST_REMOVE(node, node); in aio_free_deleted_handlers()
316 QLIST_REMOVE(node, node_deleted); in aio_free_deleted_handlers()
317 QLIST_SAFE_REMOVE(node, node_poll); in aio_free_deleted_handlers()
318 g_free(node); in aio_free_deleted_handlers()
324 static bool aio_dispatch_handler(AioContext *ctx, AioHandler *node) in aio_dispatch_handler() argument
330 revents = node->pfd.revents & node->pfd.events; in aio_dispatch_handler()
331 node->pfd.revents = 0; in aio_dispatch_handler()
333 poll_ready = node->poll_ready; in aio_dispatch_handler()
334 node->poll_ready = false; in aio_dispatch_handler()
342 if (!QLIST_IS_INSERTED(node, node_deleted) && in aio_dispatch_handler()
343 !QLIST_IS_INSERTED(node, node_poll) && in aio_dispatch_handler()
344 node->io_poll) { in aio_dispatch_handler()
345 trace_poll_add(ctx, node, node->pfd.fd, revents); in aio_dispatch_handler()
346 if (ctx->poll_started && node->io_poll_begin) { in aio_dispatch_handler()
347 node->io_poll_begin(node->opaque); in aio_dispatch_handler()
349 QLIST_INSERT_HEAD(&ctx->poll_aio_handlers, node, node_poll); in aio_dispatch_handler()
351 if (!QLIST_IS_INSERTED(node, node_deleted) && in aio_dispatch_handler()
352 poll_ready && revents == 0 && node->io_poll_ready) { in aio_dispatch_handler()
358 QLIST_SAFE_REMOVE(node, node_poll); in aio_dispatch_handler()
360 node->io_poll_ready(node->opaque); in aio_dispatch_handler()
362 if (!QLIST_IS_INSERTED(node, node_poll)) { in aio_dispatch_handler()
363 QLIST_INSERT_HEAD(&ctx->poll_aio_handlers, node, node_poll); in aio_dispatch_handler()
370 return node->opaque != &ctx->notifier; in aio_dispatch_handler()
373 if (!QLIST_IS_INSERTED(node, node_deleted) && in aio_dispatch_handler()
375 node->io_read) { in aio_dispatch_handler()
376 node->io_read(node->opaque); in aio_dispatch_handler()
379 if (node->opaque != &ctx->notifier) { in aio_dispatch_handler()
383 if (!QLIST_IS_INSERTED(node, node_deleted) && in aio_dispatch_handler()
385 node->io_write) { in aio_dispatch_handler()
386 node->io_write(node->opaque); in aio_dispatch_handler()
402 AioHandler *node; in aio_dispatch_ready_handlers() local
404 while ((node = QLIST_FIRST(ready_list))) { in aio_dispatch_ready_handlers()
405 QLIST_REMOVE(node, node_ready); in aio_dispatch_ready_handlers()
406 progress = aio_dispatch_handler(ctx, node) || progress; in aio_dispatch_ready_handlers()
412 if (ctx->poll_max_ns && QLIST_IS_INSERTED(node, node_poll)) { in aio_dispatch_ready_handlers()
413 adjust_polling_time(ctx, &node->poll, block_ns); in aio_dispatch_ready_handlers()
423 AioHandler *node, *tmp; in aio_dispatch_handlers() local
426 QLIST_FOREACH_SAFE_RCU(node, &ctx->aio_handlers, node, tmp) { in aio_dispatch_handlers()
427 progress = aio_dispatch_handler(ctx, node) || progress; in aio_dispatch_handlers()
450 AioHandler *node; in run_poll_handlers_once() local
453 QLIST_FOREACH_SAFE(node, &ctx->poll_aio_handlers, node_poll, tmp) { in run_poll_handlers_once()
454 if (node->io_poll(node->opaque)) { in run_poll_handlers_once()
455 aio_add_poll_ready_handler(ready_list, node); in run_poll_handlers_once()
457 node->poll_idle_timeout = now + POLL_IDLE_INTERVAL_NS; in run_poll_handlers_once()
464 if (node->opaque != &ctx->notifier) { in run_poll_handlers_once()
484 AioHandler *node; in remove_idle_poll_handlers() local
498 QLIST_FOREACH_SAFE(node, &ctx->poll_aio_handlers, node_poll, tmp) { in remove_idle_poll_handlers()
499 if (node->poll_idle_timeout == 0LL) { in remove_idle_poll_handlers()
500 node->poll_idle_timeout = now + POLL_IDLE_INTERVAL_NS; in remove_idle_poll_handlers()
501 } else if (now >= node->poll_idle_timeout) { in remove_idle_poll_handlers()
502 trace_poll_remove(ctx, node, node->pfd.fd); in remove_idle_poll_handlers()
503 node->poll_idle_timeout = 0LL; in remove_idle_poll_handlers()
504 QLIST_SAFE_REMOVE(node, node_poll); in remove_idle_poll_handlers()
505 if (ctx->poll_started && node->io_poll_end) { in remove_idle_poll_handlers()
506 node->io_poll_end(node->opaque); in remove_idle_poll_handlers()
513 if (node->io_poll(node->opaque)) { in remove_idle_poll_handlers()
514 aio_add_poll_ready_handler(ready_list, node); in remove_idle_poll_handlers()
594 AioHandler *node; in try_poll_mode() local
602 QLIST_FOREACH(node, &ctx->poll_aio_handlers, node_poll) { in try_poll_mode()
603 max_ns = MAX(max_ns, node->poll.ns); in try_poll_mode()
793 AioHandler *node; in aio_context_set_poll_params() local
796 QLIST_FOREACH(node, &ctx->aio_handlers, node) { in aio_context_set_poll_params()
797 node->poll.ns = 0; in aio_context_set_poll_params()