Message ID | 20230619071438.7000-2-xiubli@redhat.com |
---|---|
State | New |
Headers | show |
Series | ceph: print the client global id for debug logs | expand |
Looks good to me. Tested-by: Milind Changire <mchangir@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Milind Changire <mchangir@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> On Mon, Jun 19, 2023 at 12:47 PM <xiubli@redhat.com> wrote: > > From: Xiubo Li <xiubli@redhat.com> > > This will help print the fsid and client's global_id in debug logs, > and also print the function names. > > URL: https://tracker.ceph.com/issues/61590 > Cc: Patrick Donnelly <pdonnell@redhat.com> > Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> > Signed-off-by: Xiubo Li <xiubli@redhat.com> > --- > include/linux/ceph/ceph_debug.h | 48 ++++++++++++++++++++++++++++++++- > 1 file changed, 47 insertions(+), 1 deletion(-) > > diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h > index d5a5da838caf..0b5f210ca977 100644 > --- a/include/linux/ceph/ceph_debug.h > +++ b/include/linux/ceph/ceph_debug.h > @@ -19,12 +19,26 @@ > pr_debug("%.*s %12.12s:%-4d : " fmt, \ > 8 - (int)sizeof(KBUILD_MODNAME), " ", \ > kbasename(__FILE__), __LINE__, ##__VA_ARGS__) > +# define doutc(client, fmt, ...) \ > + pr_debug("%.*s %12.12s:%-4d : [%pU %lld] " fmt, \ > + 8 - (int)sizeof(KBUILD_MODNAME), " ", \ > + kbasename(__FILE__), __LINE__, \ > + &client->fsid, client->monc.auth->global_id, \ > + ##__VA_ARGS__) > # else > /* faux printk call just to see any compiler warnings. */ > # define dout(fmt, ...) do { \ > if (0) \ > printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ > } while (0) > +# define doutc(client, fmt, ...) do { \ > + if (0) \ > + printk(KERN_DEBUG "[%pU %lld] " fmt, \ > + &client->fsid, \ > + client->monc.auth->global_id, \ > + ##__VA_ARGS__); \ > + } while (0) > + > # endif > > #else > @@ -33,7 +47,39 @@ > * or, just wrap pr_debug > */ > # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) > - > +# define doutc(client, fmt, ...) \ > + pr_debug("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > #endif > > +# define pr_notice_client(client, fmt, ...) \ > + pr_notice("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_info_client(client, fmt, ...) \ > + pr_info("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_warn_client(client, fmt, ...) \ > + pr_warn("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_warn_once_client(client, fmt, ...) \ > + pr_warn_once("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_err_client(client, fmt, ...) \ > + pr_err("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_warn_ratelimited_client(client, fmt, ...) \ > + pr_warn_ratelimited("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > +# define pr_err_ratelimited_client(client, fmt, ...) \ > + pr_err_ratelimited("[%pU %lld] %s: " fmt, &client->fsid, \ > + client->monc.auth->global_id, __func__, \ > + ##__VA_ARGS__) > + > #endif > -- > 2.40.1 >
diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h index d5a5da838caf..0b5f210ca977 100644 --- a/include/linux/ceph/ceph_debug.h +++ b/include/linux/ceph/ceph_debug.h @@ -19,12 +19,26 @@ pr_debug("%.*s %12.12s:%-4d : " fmt, \ 8 - (int)sizeof(KBUILD_MODNAME), " ", \ kbasename(__FILE__), __LINE__, ##__VA_ARGS__) +# define doutc(client, fmt, ...) \ + pr_debug("%.*s %12.12s:%-4d : [%pU %lld] " fmt, \ + 8 - (int)sizeof(KBUILD_MODNAME), " ", \ + kbasename(__FILE__), __LINE__, \ + &client->fsid, client->monc.auth->global_id, \ + ##__VA_ARGS__) # else /* faux printk call just to see any compiler warnings. */ # define dout(fmt, ...) do { \ if (0) \ printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ } while (0) +# define doutc(client, fmt, ...) do { \ + if (0) \ + printk(KERN_DEBUG "[%pU %lld] " fmt, \ + &client->fsid, \ + client->monc.auth->global_id, \ + ##__VA_ARGS__); \ + } while (0) + # endif #else @@ -33,7 +47,39 @@ * or, just wrap pr_debug */ # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) - +# define doutc(client, fmt, ...) \ + pr_debug("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) #endif +# define pr_notice_client(client, fmt, ...) \ + pr_notice("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_info_client(client, fmt, ...) \ + pr_info("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_warn_client(client, fmt, ...) \ + pr_warn("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_warn_once_client(client, fmt, ...) \ + pr_warn_once("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_err_client(client, fmt, ...) \ + pr_err("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_warn_ratelimited_client(client, fmt, ...) \ + pr_warn_ratelimited("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) +# define pr_err_ratelimited_client(client, fmt, ...) \ + pr_err_ratelimited("[%pU %lld] %s: " fmt, &client->fsid, \ + client->monc.auth->global_id, __func__, \ + ##__VA_ARGS__) + #endif