rxrpc, afs: Use debug_ids rather than pointers in traces
In rxrpc and afs, use the debug_ids that are monotonically allocated to various objects as they're allocated rather than pointers as kernel pointers are now hashed making them less useful. Further, the debug ids aren't reused anywhere nearly as quickly. In addition, allow kernel services that use rxrpc, such as afs, to take numbers from the rxrpc counter, assign them to their own call struct and pass them in to rxrpc for both client and service calls so that the trace lines for each will have the same ID tag. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -99,7 +99,8 @@ found_extant_call:
|
||||
/*
|
||||
* allocate a new call
|
||||
*/
|
||||
struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp)
|
||||
struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp,
|
||||
unsigned int debug_id)
|
||||
{
|
||||
struct rxrpc_call *call;
|
||||
|
||||
@@ -138,7 +139,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp)
|
||||
spin_lock_init(&call->notify_lock);
|
||||
rwlock_init(&call->state_lock);
|
||||
atomic_set(&call->usage, 1);
|
||||
call->debug_id = atomic_inc_return(&rxrpc_debug_id);
|
||||
call->debug_id = debug_id;
|
||||
call->tx_total_len = -1;
|
||||
call->next_rx_timo = 20 * HZ;
|
||||
call->next_req_timo = 1 * HZ;
|
||||
@@ -166,14 +167,15 @@ nomem:
|
||||
*/
|
||||
static struct rxrpc_call *rxrpc_alloc_client_call(struct rxrpc_sock *rx,
|
||||
struct sockaddr_rxrpc *srx,
|
||||
gfp_t gfp)
|
||||
gfp_t gfp,
|
||||
unsigned int debug_id)
|
||||
{
|
||||
struct rxrpc_call *call;
|
||||
ktime_t now;
|
||||
|
||||
_enter("");
|
||||
|
||||
call = rxrpc_alloc_call(rx, gfp);
|
||||
call = rxrpc_alloc_call(rx, gfp, debug_id);
|
||||
if (!call)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
call->state = RXRPC_CALL_CLIENT_AWAIT_CONN;
|
||||
@@ -214,7 +216,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
|
||||
struct rxrpc_conn_parameters *cp,
|
||||
struct sockaddr_rxrpc *srx,
|
||||
struct rxrpc_call_params *p,
|
||||
gfp_t gfp)
|
||||
gfp_t gfp,
|
||||
unsigned int debug_id)
|
||||
__releases(&rx->sk.sk_lock.slock)
|
||||
{
|
||||
struct rxrpc_call *call, *xcall;
|
||||
@@ -225,7 +228,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
|
||||
|
||||
_enter("%p,%lx", rx, p->user_call_ID);
|
||||
|
||||
call = rxrpc_alloc_client_call(rx, srx, gfp);
|
||||
call = rxrpc_alloc_client_call(rx, srx, gfp, debug_id);
|
||||
if (IS_ERR(call)) {
|
||||
release_sock(&rx->sk);
|
||||
_leave(" = %ld", PTR_ERR(call));
|
||||
|
Reference in New Issue
Block a user