From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Christian Brauner <brauner@kernel.org>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
Simon Horman <horms@kernel.org>
Subject: [PATCH net-next 08/15] afs: Improve afs_volume tracing to display a debug ID
Date: Mon, 24 Feb 2025 23:41:45 +0000 [thread overview]
Message-ID: <20250224234154.2014840-9-dhowells@redhat.com> (raw)
In-Reply-To: <20250224234154.2014840-1-dhowells@redhat.com>
Improve the tracing of afs_volume objects to include displaying a debug ID
so that different instances of volumes with the same "vid" can be
distinguished.
Also be consistent about displaying the volume's refcount (and not the
cell's).
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
fs/afs/internal.h | 1 +
fs/afs/volume.c | 15 +++++++++------
include/trace/events/afs.h | 18 +++++++++++-------
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 89be1014968d..bbd550d496a7 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -623,6 +623,7 @@ struct afs_volume {
afs_volid_t vid; /* The volume ID of this volume */
afs_volid_t vids[AFS_MAXTYPES]; /* All associated volume IDs */
refcount_t ref;
+ unsigned int debug_id; /* Debugging ID for traces */
time64_t update_at; /* Time at which to next update */
struct afs_cell *cell; /* Cell to which belongs (pins ref) */
struct rb_node cell_node; /* Link in cell->volumes */
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index af3a3f57c1b3..0efff3d25133 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -10,6 +10,7 @@
#include "internal.h"
static unsigned __read_mostly afs_volume_record_life = 60 * 60;
+static atomic_t afs_volume_debug_id;
static void afs_destroy_volume(struct work_struct *work);
@@ -59,7 +60,7 @@ static void afs_remove_volume_from_cell(struct afs_volume *volume)
struct afs_cell *cell = volume->cell;
if (!hlist_unhashed(&volume->proc_link)) {
- trace_afs_volume(volume->vid, refcount_read(&cell->ref),
+ trace_afs_volume(volume->debug_id, volume->vid, refcount_read(&volume->ref),
afs_volume_trace_remove);
write_seqlock(&cell->volume_lock);
hlist_del_rcu(&volume->proc_link);
@@ -84,6 +85,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params,
if (!volume)
goto error_0;
+ volume->debug_id = atomic_inc_return(&afs_volume_debug_id);
volume->vid = vldb->vid[params->type];
volume->update_at = ktime_get_real_seconds() + afs_volume_record_life;
volume->cell = afs_get_cell(params->cell, afs_cell_trace_get_vol);
@@ -115,7 +117,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params,
*_slist = slist;
rcu_assign_pointer(volume->servers, slist);
- trace_afs_volume(volume->vid, 1, afs_volume_trace_alloc);
+ trace_afs_volume(volume->debug_id, volume->vid, 1, afs_volume_trace_alloc);
return volume;
error_1:
@@ -247,7 +249,7 @@ static void afs_destroy_volume(struct work_struct *work)
afs_remove_volume_from_cell(volume);
afs_put_serverlist(volume->cell->net, slist);
afs_put_cell(volume->cell, afs_cell_trace_put_vol);
- trace_afs_volume(volume->vid, refcount_read(&volume->ref),
+ trace_afs_volume(volume->debug_id, volume->vid, refcount_read(&volume->ref),
afs_volume_trace_free);
kfree_rcu(volume, rcu);
@@ -262,7 +264,7 @@ bool afs_try_get_volume(struct afs_volume *volume, enum afs_volume_trace reason)
int r;
if (__refcount_inc_not_zero(&volume->ref, &r)) {
- trace_afs_volume(volume->vid, r + 1, reason);
+ trace_afs_volume(volume->debug_id, volume->vid, r + 1, reason);
return true;
}
return false;
@@ -278,7 +280,7 @@ struct afs_volume *afs_get_volume(struct afs_volume *volume,
int r;
__refcount_inc(&volume->ref, &r);
- trace_afs_volume(volume->vid, r + 1, reason);
+ trace_afs_volume(volume->debug_id, volume->vid, r + 1, reason);
}
return volume;
}
@@ -290,12 +292,13 @@ struct afs_volume *afs_get_volume(struct afs_volume *volume,
void afs_put_volume(struct afs_volume *volume, enum afs_volume_trace reason)
{
if (volume) {
+ unsigned int debug_id = volume->debug_id;
afs_volid_t vid = volume->vid;
bool zero;
int r;
zero = __refcount_dec_and_test(&volume->ref, &r);
- trace_afs_volume(vid, r - 1, reason);
+ trace_afs_volume(debug_id, vid, r - 1, reason);
if (zero)
schedule_work(&volume->destructor);
}
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
index c19132605f41..cf94bf1e8286 100644
--- a/include/trace/events/afs.h
+++ b/include/trace/events/afs.h
@@ -1539,25 +1539,29 @@ TRACE_EVENT(afs_server,
);
TRACE_EVENT(afs_volume,
- TP_PROTO(afs_volid_t vid, int ref, enum afs_volume_trace reason),
+ TP_PROTO(unsigned int debug_id, afs_volid_t vid, int ref,
+ enum afs_volume_trace reason),
- TP_ARGS(vid, ref, reason),
+ TP_ARGS(debug_id, vid, ref, reason),
TP_STRUCT__entry(
+ __field(unsigned int, debug_id)
__field(afs_volid_t, vid)
__field(int, ref)
__field(enum afs_volume_trace, reason)
),
TP_fast_assign(
- __entry->vid = vid;
- __entry->ref = ref;
- __entry->reason = reason;
+ __entry->debug_id = debug_id;
+ __entry->vid = vid;
+ __entry->ref = ref;
+ __entry->reason = reason;
),
- TP_printk("V=%llx %s ur=%d",
- __entry->vid,
+ TP_printk("V=%08x %s vid=%llx r=%d",
+ __entry->debug_id,
__print_symbolic(__entry->reason, afs_volume_traces),
+ __entry->vid,
__entry->ref)
);
next prev parent reply other threads:[~2025-02-24 23:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 23:41 [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records David Howells
2025-02-24 23:41 ` [PATCH net-next 01/15] rxrpc: rxperf: Fix missing decoding of terminal magic cookie David Howells
2025-02-24 23:41 ` [PATCH net-next 02/15] rxrpc: peer->mtu_lock is redundant David Howells
2025-02-24 23:41 ` [PATCH net-next 03/15] rxrpc: Fix locking issues with the peer record hash David Howells
2025-02-24 23:41 ` [PATCH net-next 04/15] afs: Fix the server_list to unuse a displaced server rather than putting it David Howells
2025-02-24 23:41 ` [PATCH net-next 05/15] afs: Give an afs_server object a ref on the afs_cell object it points to David Howells
2025-02-24 23:41 ` [PATCH net-next 06/15] afs: Remove the "autocell" mount option David Howells
2025-02-24 23:41 ` [PATCH net-next 07/15] afs: Change dynroot to create contents on demand David Howells
2025-02-24 23:41 ` David Howells [this message]
2025-02-24 23:41 ` [PATCH net-next 09/15] afs: Improve server refcount/active count tracing David Howells
2025-02-24 23:41 ` [PATCH net-next 10/15] afs: Make afs_lookup_cell() take a trace note David Howells
2025-02-24 23:41 ` [PATCH net-next 11/15] afs: Drop the net parameter from afs_unuse_cell() David Howells
2025-02-24 23:41 ` [PATCH net-next 12/15] rxrpc: Allow the app to store private data on peer structs David Howells
2025-02-24 23:41 ` [PATCH net-next 13/15] afs: Use the per-peer app data provided by rxrpc David Howells
2025-02-24 23:41 ` [PATCH net-next 14/15] afs: Fix afs_server ref accounting David Howells
2025-02-24 23:41 ` [PATCH net-next 15/15] afs: Simplify cell record handling David Howells
2025-02-27 11:27 ` [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records Paolo Abeni
2025-02-27 13:10 ` David Howells
2025-02-27 14:43 ` Paolo Abeni
2025-02-27 15:36 ` Which tree to push afs + crypto + rxrpc spanning patches through? David Howells
2025-02-28 8:08 ` Herbert Xu
2025-02-27 19:20 ` [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records patchwork-bot+netdevbpf
2025-02-28 0:49 ` Jakub Kicinski
2025-02-28 6:52 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250224234154.2014840-9-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox