rxrpc: Add connection tracepoint and client conn state tracepoint
Add a pair of tracepoints, one to track rxrpc_connection struct ref counting and the other to track the client connection cache state. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -246,11 +246,77 @@ void rxrpc_kill_connection(struct rxrpc_connection *conn)
|
||||
}
|
||||
|
||||
/*
|
||||
* release a virtual connection
|
||||
* Queue a connection's work processor, getting a ref to pass to the work
|
||||
* queue.
|
||||
*/
|
||||
void __rxrpc_put_connection(struct rxrpc_connection *conn)
|
||||
bool rxrpc_queue_conn(struct rxrpc_connection *conn)
|
||||
{
|
||||
rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0);
|
||||
const void *here = __builtin_return_address(0);
|
||||
int n = __atomic_add_unless(&conn->usage, 1, 0);
|
||||
if (n == 0)
|
||||
return false;
|
||||
if (rxrpc_queue_work(&conn->processor))
|
||||
trace_rxrpc_conn(conn, rxrpc_conn_queued, n + 1, here);
|
||||
else
|
||||
rxrpc_put_connection(conn);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note the re-emergence of a connection.
|
||||
*/
|
||||
void rxrpc_see_connection(struct rxrpc_connection *conn)
|
||||
{
|
||||
const void *here = __builtin_return_address(0);
|
||||
if (conn) {
|
||||
int n = atomic_read(&conn->usage);
|
||||
|
||||
trace_rxrpc_conn(conn, rxrpc_conn_seen, n, here);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a ref on a connection.
|
||||
*/
|
||||
void rxrpc_get_connection(struct rxrpc_connection *conn)
|
||||
{
|
||||
const void *here = __builtin_return_address(0);
|
||||
int n = atomic_inc_return(&conn->usage);
|
||||
|
||||
trace_rxrpc_conn(conn, rxrpc_conn_got, n, here);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to get a ref on a connection.
|
||||
*/
|
||||
struct rxrpc_connection *
|
||||
rxrpc_get_connection_maybe(struct rxrpc_connection *conn)
|
||||
{
|
||||
const void *here = __builtin_return_address(0);
|
||||
|
||||
if (conn) {
|
||||
int n = __atomic_add_unless(&conn->usage, 1, 0);
|
||||
if (n > 0)
|
||||
trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here);
|
||||
else
|
||||
conn = NULL;
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Release a service connection
|
||||
*/
|
||||
void rxrpc_put_service_conn(struct rxrpc_connection *conn)
|
||||
{
|
||||
const void *here = __builtin_return_address(0);
|
||||
int n;
|
||||
|
||||
n = atomic_dec_return(&conn->usage);
|
||||
trace_rxrpc_conn(conn, rxrpc_conn_put_service, n, here);
|
||||
ASSERTCMP(n, >=, 0);
|
||||
if (n == 0)
|
||||
rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user