]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
fixups
authorAlex Markuze <amarkuze@redhat.com>
Tue, 18 Mar 2025 15:50:01 +0000 (15:50 +0000)
committerAlex Markuze <amarkuze@redhat.com>
Tue, 18 Mar 2025 15:50:01 +0000 (15:50 +0000)
include/linux/ceph/ceph_debug.h
include/linux/ceph/ceph_san_logger.h
net/ceph/ceph_san_logger.c

index 59c35957e0238e322e6856b1d977abc919c74036..2d6509bbdca9f142a8dd0dbb8dd9dcf5c3e2225c 100644 (file)
@@ -22,8 +22,7 @@
        pr_debug("%.*s %12.12s:%-4d:" fmt,                              \
                 8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
                 kbasename(__FILE__), __LINE__, ##__VA_ARGS__);         \
-       CEPH_SAN_LOG("%12.12s:%-4d : " fmt,                             \
-                kbasename(__FILE__), __LINE__, ##__VA_ARGS__);         \
+       CEPH_SAN_LOG(fmt,  ##__VA_ARGS__);              \
        } while (0)
 #  define doutc(client, fmt, ...)                                      \
        do {                                                            \
@@ -32,8 +31,8 @@
                 kbasename(__FILE__), __LINE__,                         \
                 &client->fsid, client->monc.auth->global_id,           \
                 ##__VA_ARGS__);                                        \
-       CEPH_SAN_LOG("%12.12s:%-4d:" fmt,                               \
-                kbasename(__FILE__), __LINE__, ##__VA_ARGS__);         \
+       CEPH_SAN_LOG("[%pU:%llu] " fmt, &client->fsid,                  \
+                client->monc.auth->global_id, ##__VA_ARGS__);          \
        } while (0)
 # else
 /* faux printk call just to see any compiler warnings. */
@@ -53,7 +52,7 @@
  */
 # define dout(fmt, ...)        CEPH_SAN_LOG(fmt, ##__VA_ARGS__)
 # define doutc(client, fmt, ...)                                       \
-       CEPH_SAN_LOG(" [%pU %llu] %s: " fmt, &client->fsid,                     \
+       CEPH_SAN_LOG(" [%pU:%llu] %s: " fmt, &client->fsid,                     \
                 client->monc.auth->global_id, __func__, ##__VA_ARGS__)
 
 #endif
index e8614e46a51aecbd2f8dfc3e2cd0f401bfc59188..b4c2cec7cd5b78ea20f0a4736097cc9e04a52230 100644 (file)
@@ -18,7 +18,8 @@ struct ceph_san_log_entry {
     unsigned int line;          /* Line number */
     unsigned int len;           /* Length of the message */
     const char *file;          /* Source file */
-    char buffer[0];            /* Flexible array for inline buffer */
+    const char *func;          /* Source function */
+    char *buffer;            /* Flexible array for inline buffer */
 };
 
 /* TLS context structure */
@@ -58,14 +59,14 @@ int ceph_san_logger_init(void);
 void ceph_san_logger_cleanup(void);
 
 /* Log a message */
-void ceph_san_log(const char *file, unsigned int line, const char *fmt, ...);
+void ceph_san_log(const char *file, const char *func, unsigned int line, const char *fmt, ...);
 
 /* Get current TLS context, creating if necessary */
 struct ceph_san_tls_ctx *ceph_san_get_tls_ctx(void);
 
 /* Helper macro for logging */
 #define CEPH_SAN_LOG(fmt, ...) \
-    ceph_san_log(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
+    ceph_san_log(kbasename(__FILE__), __func__, __LINE__, fmt, ##__VA_ARGS__)
 
 /* Global logger instance */
 extern struct ceph_san_logger g_logger;
index 4e4461fe655d17104abeea9906775c4a1baab521..f423bc6d691c7b26d309975f914cb6f24fdd5457 100644 (file)
@@ -47,6 +47,7 @@ static void ceph_san_tls_release(void *ptr)
         return;
 
     /* Add context to log batch */
+    ctx->task = NULL;
     ceph_san_batch_put(&g_logger.log_batch, ctx);
 
     /* If log_batch has too many full magazines, move one to alloc_batch */
@@ -100,7 +101,8 @@ struct ceph_san_tls_ctx *ceph_san_get_tls_ctx(void)
     /* Set up TLS */
     current->tls.state = ctx;
     current->tls.release = ceph_san_tls_release;
-
+    task_state_to_char(current);
+    ctx->task = current;
     return ctx;
 }
 EXPORT_SYMBOL(ceph_san_get_tls_ctx);
@@ -113,7 +115,7 @@ EXPORT_SYMBOL(ceph_san_get_tls_ctx);
  *
  * Logs a message to the current TLS context's log buffer
  */
-void ceph_san_log(const char *file, unsigned int line, const char *fmt, ...)
+void ceph_san_log(const char *file, const char *func, unsigned int line, const char *fmt, ...)
 {
     /* Format the message into local buffer first */
     char buf[256];
@@ -158,6 +160,8 @@ void ceph_san_log(const char *file, unsigned int line, const char *fmt, ...)
     entry->ts = jiffies;
     entry->line = line;
     entry->file = file;
+    entry->func = func;
+    entry->buffer = (char *)(entry + 1);
     entry->len = cephsan_pagefrag_get_alloc_size(alloc);
     spin_unlock(&ctx->pf.lock);