X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libringbuffer%2Fring_buffer_backend.c;h=d676b5f8a77c22864f0b93aa3fc77243b665fca9;hb=2fed87aef82aaa8edfb6d8d8ac6bbf5f1e67b955;hp=f2169aa7b83e3e331429e7707bbd08824bd9a1cb;hpb=4318ae1be57eb7983ab4857a7a8eeb4a030a8216;p=lttng-ust.git diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c index f2169aa7..d676b5f8 100644 --- a/libringbuffer/ring_buffer_backend.c +++ b/libringbuffer/ring_buffer_backend.c @@ -11,6 +11,7 @@ #include "lttng/core.h" #include +#include "vatomic.h" #include "backend.h" #include "frontend.h" #include "smp.h" @@ -129,14 +130,6 @@ int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *buf handle, shmobj); } -void lib_ring_buffer_backend_free(struct lttng_ust_lib_ring_buffer_backend *bufb) -{ - /* bufb->buf_wsb will be freed by shm teardown */ - /* bufb->array[i] will be freed by shm teardown */ - /* bufb->array will be freed by shm teardown */ - bufb->allocated = 0; -} - void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb, struct lttng_ust_shm_handle *handle) { @@ -190,7 +183,6 @@ void channel_backend_reset(struct channel_backend *chanb) * @chanb: channel backend * @name: channel name * @config: client ring buffer configuration - * @priv: client private data * @parent: dentry of parent directory, %NULL for root directory * @subbuf_size: size of sub-buffers (> PAGE_SIZE, power of 2) * @num_subbuf: number of sub-buffers (power of 2) @@ -207,7 +199,7 @@ void channel_backend_reset(struct channel_backend *chanb) int channel_backend_init(struct channel_backend *chanb, const char *name, const struct lttng_ust_lib_ring_buffer_config *config, - void *priv, size_t subbuf_size, size_t num_subbuf, + size_t subbuf_size, size_t num_subbuf, struct lttng_ust_shm_handle *handle) { struct channel *chan = caa_container_of(chanb, struct channel, backend); @@ -235,7 +227,6 @@ int channel_backend_init(struct channel_backend *chanb, if (ret) return ret; - chanb->priv = priv; chanb->buf_size = num_subbuf * subbuf_size; chanb->subbuf_size = subbuf_size; chanb->buf_size_order = get_count_order(chanb->buf_size); @@ -313,15 +304,6 @@ int channel_backend_init(struct channel_backend *chanb, return 0; free_bufs: - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { - for_each_possible_cpu(i) { - struct lttng_ust_lib_ring_buffer *buf = shmp(handle, chanb->buf[i].shmp); - - if (!buf->backend.allocated) - continue; - lib_ring_buffer_free(buf, handle); - } - } /* We only free the buffer data upon shm teardown */ end: return -ENOMEM; @@ -336,24 +318,7 @@ end: void channel_backend_free(struct channel_backend *chanb, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config; - unsigned int i; - - if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { - for_each_possible_cpu(i) { - struct lttng_ust_lib_ring_buffer *buf = shmp(handle, chanb->buf[i].shmp); - - if (!buf->backend.allocated) - continue; - lib_ring_buffer_free(buf, handle); - } - } else { - struct lttng_ust_lib_ring_buffer *buf = shmp(handle, chanb->buf[0].shmp); - - CHAN_WARN_ON(chanb, !buf->backend.allocated); - lib_ring_buffer_free(buf, handle); - } - /* We only free the buffer data upon shm teardown */ + /* SHM teardown takes care of everything */ } /**