X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-relayd%2Findex.c;h=cb7ae3db966e34ae3205c00a4f04f15853f3e247;hb=3d07a857948f868354589ff742b0a2f6277f558f;hp=7182e36cc8e461daf666d6dbc32079dd11b7e5f3;hpb=03e431550191df8609f921c7b4054c57ee4644d8;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/index.c b/src/bin/lttng-relayd/index.c index 7182e36cc..cb7ae3db9 100644 --- a/src/bin/lttng-relayd/index.c +++ b/src/bin/lttng-relayd/index.c @@ -333,3 +333,42 @@ void relay_index_close_all(struct relay_stream *stream) } rcu_read_unlock(); } + +void relay_index_close_partial_fd(struct relay_stream *stream) +{ + struct lttng_ht_iter iter; + struct relay_index *index; + + rcu_read_lock(); + cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter, + index, index_n.node) { + if (!index->index_fd) { + continue; + } + /* + * Partial index has its index_fd: we have only + * received its info from the data socket. + * Put self-ref from index. + */ + relay_index_put(index); + } + rcu_read_unlock(); +} + +uint64_t relay_index_find_last(struct relay_stream *stream) +{ + struct lttng_ht_iter iter; + struct relay_index *index; + uint64_t net_seq_num = -1ULL; + + rcu_read_lock(); + cds_lfht_for_each_entry(stream->indexes_ht->ht, &iter.iter, + index, index_n.node) { + if (net_seq_num == -1ULL || + index->index_n.key > net_seq_num) { + net_seq_num = index->index_n.key; + } + } + rcu_read_unlock(); + return net_seq_num; +}