Lines Matching refs:ch

389 	struct spdk_io_channel *ch;
393 RB_FOREACH(ch, io_channel_tree, &thread->io_channels) {
395 thread->name, ch->dev->name);
661 struct spdk_io_channel *ch;
705 RB_FOREACH(ch, io_channel_tree, &thread->io_channels) {
708 thread->name, ch->dev->name);
2348 struct spdk_io_channel *ch;
2374 ch = thread_get_io_channel(thread, dev);
2375 if (ch != NULL) {
2376 ch->ref++;
2379 ch, dev->name, dev->io_device, thread->name, ch->ref);
2387 (uint64_t)spdk_io_channel_get_ctx(ch), ch->ref);
2388 return ch;
2391 ch = calloc(1, sizeof(*ch) + dev->ctx_size);
2392 if (ch == NULL) {
2398 ch->dev = dev;
2399 ch->destroy_cb = dev->destroy_cb;
2400 ch->thread = thread;
2401 ch->ref = 1;
2402 ch->destroy_ref = 0;
2403 RB_INSERT(io_channel_tree, &thread->io_channels, ch);
2406 ch, dev->name, dev->io_device, thread->name, ch->ref);
2412 rc = dev->create_cb(io_device, (uint8_t *)ch + sizeof(*ch));
2415 RB_REMOVE(io_channel_tree, &ch->thread->io_channels, ch);
2417 free(ch);
2424 spdk_trace_record(TRACE_THREAD_IOCH_GET, 0, 0, (uint64_t)spdk_io_channel_get_ctx(ch), 1);
2425 return ch;
2431 struct spdk_io_channel *ch = arg;
2444 ch, ch->dev->name, ch->dev->io_device, thread->name);
2446 assert(ch->thread == thread);
2448 ch->destroy_ref--;
2450 if (ch->ref > 0 || ch->destroy_ref > 0) {
2460 RB_REMOVE(io_channel_tree, &ch->thread->io_channels, ch);
2464 ch->destroy_cb(ch->dev->io_device, spdk_io_channel_get_ctx(ch));
2467 ch->dev->refcnt--;
2469 if (!ch->dev->unregistered) {
2473 if (ch->dev->refcnt > 0) {
2480 io_device_free(ch->dev);
2482 free(ch);
2486 spdk_put_io_channel(struct spdk_io_channel *ch)
2492 (uint64_t)spdk_io_channel_get_ctx(ch), ch->ref);
2501 if (ch->thread != thread) {
2502 wrong_thread(__func__, "ch", ch->thread, thread);
2508 ch, ch->dev->name, ch->dev->io_device, thread->name, ch->ref);
2510 ch->ref--;
2512 if (ch->ref == 0) {
2513 ch->destroy_ref++;
2514 rc = spdk_thread_send_msg(thread, put_io_channel, ch);
2526 spdk_io_channel_get_thread(struct spdk_io_channel *ch)
2528 return ch->thread;
2532 spdk_io_channel_get_io_device(struct spdk_io_channel *ch)
2534 return ch->dev->io_device;
2538 spdk_io_channel_get_io_device_name(struct spdk_io_channel *ch)
2540 return spdk_io_device_get_name(ch->dev);
2544 spdk_io_channel_get_ref_count(struct spdk_io_channel *ch)
2546 return ch->ref;
2555 struct spdk_io_channel *ch;
2572 return i->ch;
2599 struct spdk_io_channel *ch;
2607 ch = thread_get_io_channel(i->cur_thread, i->dev);
2610 if (ch) {
2622 struct spdk_io_channel *ch;
2660 ch = thread_get_io_channel(thread, i->dev);
2661 if (ch != NULL) {
2662 ch->dev->for_each_count++;
2664 i->ch = ch;
2693 struct spdk_io_channel *ch;
2709 ch = thread_get_io_channel(thread, dev);
2710 if (ch != NULL) {
2712 i->ch = ch;
2723 i->ch = NULL;