• Home
  • Raw
  • Download

Lines Matching refs:chan

36 	buf->chan->cb->buf_unmapped(buf, vma->vm_file);  in relay_file_mmap_close()
114 if (length != (unsigned long)buf->chan->alloc_size) in relay_mmap_buf()
120 buf->chan->cb->buf_mapped(buf, filp); in relay_mmap_buf()
172 static struct rchan_buf *relay_create_buf(struct rchan *chan) in relay_create_buf() argument
178 buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL); in relay_create_buf()
182 buf->start = relay_alloc_buf(buf, &chan->alloc_size); in relay_create_buf()
186 buf->chan = chan; in relay_create_buf()
187 kref_get(&buf->chan->kref); in relay_create_buf()
204 struct rchan *chan = container_of(kref, struct rchan, kref); in relay_destroy_channel() local
205 kfree(chan); in relay_destroy_channel()
214 struct rchan *chan = buf->chan; in relay_destroy_buf() local
223 chan->buf[buf->cpu] = NULL; in relay_destroy_buf()
226 kref_put(&chan->kref, relay_destroy_channel); in relay_destroy_buf()
240 buf->chan->cb->remove_buf_file(buf->dentry); in relay_remove_buf()
264 return (ready >= buf->chan->n_subbufs) ? 1 : 0; in relay_buf_full()
373 for (i = 0; i < buf->chan->n_subbufs; i++) in __relay_reset()
376 buf->chan->cb->subbuf_start(buf, buf->data, NULL, 0); in __relay_reset()
390 void relay_reset(struct rchan *chan) in relay_reset() argument
394 if (!chan) in relay_reset()
397 if (chan->is_global && chan->buf[0]) { in relay_reset()
398 __relay_reset(chan->buf[0], 0); in relay_reset()
404 if (chan->buf[i]) in relay_reset()
405 __relay_reset(chan->buf[i], 0); in relay_reset()
417 static struct dentry *relay_create_buf_file(struct rchan *chan, in relay_create_buf_file() argument
427 snprintf(tmpname, NAME_MAX, "%s%d", chan->base_filename, cpu); in relay_create_buf_file()
430 dentry = chan->cb->create_buf_file(tmpname, chan->parent, in relay_create_buf_file()
432 &chan->is_global); in relay_create_buf_file()
444 static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu) in relay_open_buf() argument
449 if (chan->is_global) in relay_open_buf()
450 return chan->buf[0]; in relay_open_buf()
452 buf = relay_create_buf(chan); in relay_open_buf()
456 if (chan->has_base_filename) { in relay_open_buf()
457 dentry = relay_create_buf_file(chan, buf, cpu); in relay_open_buf()
466 if(chan->is_global) { in relay_open_buf()
467 chan->buf[0] = buf; in relay_open_buf()
493 static void setup_callbacks(struct rchan *chan, in setup_callbacks() argument
497 chan->cb = &default_channel_callbacks; in setup_callbacks()
511 chan->cb = cb; in setup_callbacks()
527 struct rchan *chan; in relay_hotcpu_callback() local
533 list_for_each_entry(chan, &relay_channels, list) { in relay_hotcpu_callback()
534 if (chan->buf[hotcpu]) in relay_hotcpu_callback()
536 chan->buf[hotcpu] = relay_open_buf(chan, hotcpu); in relay_hotcpu_callback()
537 if(!chan->buf[hotcpu]) { in relay_hotcpu_callback()
580 struct rchan *chan; in relay_open() local
585 chan = kzalloc(sizeof(struct rchan), GFP_KERNEL); in relay_open()
586 if (!chan) in relay_open()
589 chan->version = RELAYFS_CHANNEL_VERSION; in relay_open()
590 chan->n_subbufs = n_subbufs; in relay_open()
591 chan->subbuf_size = subbuf_size; in relay_open()
592 chan->alloc_size = FIX_SIZE(subbuf_size * n_subbufs); in relay_open()
593 chan->parent = parent; in relay_open()
594 chan->private_data = private_data; in relay_open()
596 chan->has_base_filename = 1; in relay_open()
597 strlcpy(chan->base_filename, base_filename, NAME_MAX); in relay_open()
599 setup_callbacks(chan, cb); in relay_open()
600 kref_init(&chan->kref); in relay_open()
604 chan->buf[i] = relay_open_buf(chan, i); in relay_open()
605 if (!chan->buf[i]) in relay_open()
608 list_add(&chan->list, &relay_channels); in relay_open()
611 return chan; in relay_open()
615 if (chan->buf[i]) in relay_open()
616 relay_close_buf(chan->buf[i]); in relay_open()
619 kref_put(&chan->kref, relay_destroy_channel); in relay_open()
649 int relay_late_setup_files(struct rchan *chan, in relay_late_setup_files() argument
659 if (!chan || !base_filename) in relay_late_setup_files()
662 strlcpy(chan->base_filename, base_filename, NAME_MAX); in relay_late_setup_files()
666 if (unlikely(chan->has_base_filename)) { in relay_late_setup_files()
670 chan->has_base_filename = 1; in relay_late_setup_files()
671 chan->parent = parent; in relay_late_setup_files()
679 if (unlikely(!chan->buf[i])) { in relay_late_setup_files()
687 dentry = relay_create_buf_file(chan, chan->buf[i], i); in relay_late_setup_files()
695 relay_set_buf_dentry(chan->buf[i], dentry); in relay_late_setup_files()
698 disp.buf = chan->buf[i]; in relay_late_setup_files()
730 if (unlikely(length > buf->chan->subbuf_size)) in relay_switch_subbuf()
733 if (buf->offset != buf->chan->subbuf_size + 1) { in relay_switch_subbuf()
734 buf->prev_padding = buf->chan->subbuf_size - buf->offset; in relay_switch_subbuf()
735 old_subbuf = buf->subbufs_produced % buf->chan->n_subbufs; in relay_switch_subbuf()
740 buf->chan->subbuf_size - in relay_switch_subbuf()
743 buf->early_bytes += buf->chan->subbuf_size - in relay_switch_subbuf()
757 new_subbuf = buf->subbufs_produced % buf->chan->n_subbufs; in relay_switch_subbuf()
758 new = buf->start + new_subbuf * buf->chan->subbuf_size; in relay_switch_subbuf()
760 if (!buf->chan->cb->subbuf_start(buf, new, old, buf->prev_padding)) { in relay_switch_subbuf()
761 buf->offset = buf->chan->subbuf_size + 1; in relay_switch_subbuf()
767 if (unlikely(length + buf->offset > buf->chan->subbuf_size)) in relay_switch_subbuf()
773 buf->chan->last_toobig = length; in relay_switch_subbuf()
791 void relay_subbufs_consumed(struct rchan *chan, in relay_subbufs_consumed() argument
797 if (!chan) in relay_subbufs_consumed()
800 if (cpu >= NR_CPUS || !chan->buf[cpu]) in relay_subbufs_consumed()
803 buf = chan->buf[cpu]; in relay_subbufs_consumed()
816 void relay_close(struct rchan *chan) in relay_close() argument
820 if (!chan) in relay_close()
824 if (chan->is_global && chan->buf[0]) in relay_close()
825 relay_close_buf(chan->buf[0]); in relay_close()
828 if (chan->buf[i]) in relay_close()
829 relay_close_buf(chan->buf[i]); in relay_close()
831 if (chan->last_toobig) in relay_close()
834 chan->last_toobig, chan->subbuf_size); in relay_close()
836 list_del(&chan->list); in relay_close()
837 kref_put(&chan->kref, relay_destroy_channel); in relay_close()
848 void relay_flush(struct rchan *chan) in relay_flush() argument
852 if (!chan) in relay_flush()
855 if (chan->is_global && chan->buf[0]) { in relay_flush()
856 relay_switch_subbuf(chan->buf[0], 0); in relay_flush()
862 if (chan->buf[i]) in relay_flush()
863 relay_switch_subbuf(chan->buf[i], 0); in relay_flush()
944 size_t subbuf_size = buf->chan->subbuf_size; in relay_file_read_consume()
945 size_t n_subbufs = buf->chan->n_subbufs; in relay_file_read_consume()
953 relay_subbufs_consumed(buf->chan, buf->cpu, 1); in relay_file_read_consume()
961 read_subbuf = read_pos / buf->chan->subbuf_size; in relay_file_read_consume()
966 relay_subbufs_consumed(buf->chan, buf->cpu, 1); in relay_file_read_consume()
976 size_t subbuf_size = buf->chan->subbuf_size; in relay_file_read_avail()
977 size_t n_subbufs = buf->chan->n_subbufs; in relay_file_read_avail()
1023 size_t subbuf_size = buf->chan->subbuf_size; in relay_file_read_subbuf_avail()
1053 size_t subbuf_size = buf->chan->subbuf_size; in relay_file_read_start_pos()
1054 size_t n_subbufs = buf->chan->n_subbufs; in relay_file_read_start_pos()
1082 size_t subbuf_size = buf->chan->subbuf_size; in relay_file_read_end_pos()
1083 size_t n_subbufs = buf->chan->n_subbufs; in relay_file_read_end_pos()
1186 if (rbuf->bytes_consumed >= rbuf->chan->subbuf_size) { in relay_consume_bytes()
1187 relay_subbufs_consumed(rbuf->chan, rbuf->cpu, 1); in relay_consume_bytes()
1188 rbuf->bytes_consumed %= rbuf->chan->subbuf_size; in relay_consume_bytes()
1227 unsigned int subbuf_size = rbuf->chan->subbuf_size; in subbuf_splice_actor()
1229 uint32_t alloc_size = (uint32_t) rbuf->chan->alloc_size; in subbuf_splice_actor()
1254 subbuf_pages = rbuf->chan->alloc_size >> PAGE_SHIFT; in subbuf_splice_actor()