if (*p)
goto out;
- if (pool_ns)
+ if (pool_ns) {
doutc(cl, "pool %lld ns %.*s no perm cached\n", pool,
- (int)pool_ns->len, pool_ns->str);
- else
+ (int)pool_ns->len, "FIXME");
+ } else {
doutc(cl, "pool %lld no perm cached\n", pool);
+ }
down_write(&mdsc->pool_perm_rwsem);
p = &mdsc->pool_perm_tree.rb_node;
out:
if (!err)
err = have;
- if (pool_ns)
+ if (pool_ns) {
doutc(cl, "pool %lld ns %.*s result = %d\n", pool,
- (int)pool_ns->len, pool_ns->str, err);
- else
+ (int)pool_ns->len, "FIXME", err);
+ } else {
doutc(cl, "pool %lld result = %d\n", pool, err);
+ }
return err;
}
*/
# define dout(fmt, ...) CEPH_SAN_LOG(fmt, ##__VA_ARGS__)
# define doutc(client, fmt, ...) \
- CEPH_SAN_LOG(" [%pU:%llu] %s: " fmt, &client->fsid, \
- client->monc.auth->global_id, __func__, ##__VA_ARGS__)
+ CEPH_SAN_LOG("[%pU:%llu] " fmt, &client->fsid, \
+ client->monc.auth->global_id, ##__VA_ARGS__);
#endif
const char *file;
const char *func;
unsigned int line;
+ const char *fmt; /* Format string */
};
/* Log entry structure */
void ceph_san_logger_cleanup(void);
/* Get or create source ID */
-u32 ceph_san_get_source_id(const char *file, const char *func, unsigned int line);
+u32 ceph_san_get_source_id(const char *file, const char *func, unsigned int line, const char *fmt);
/* Get source information for ID */
const struct ceph_san_source_info *ceph_san_get_source_info(u32 id);
/* Log a message */
-void ceph_san_log(u32 source_id, const char *fmt, ...);
+void ceph_san_log(u32 source_id, ...);
/* Get current TLS context, creating if necessary */
struct ceph_san_tls_ctx *ceph_san_get_tls_ctx(void);
#define CEPH_SAN_LOG(fmt, ...) \
do { \
static u32 __source_id = 0; \
+ static size_t __size = 0; \
if (__source_id == 0) { \
- __source_id = ceph_san_get_source_id(kbasename(__FILE__), __func__, __LINE__); \
+ __source_id = ceph_san_get_source_id(kbasename(__FILE__), __func__, __LINE__, fmt); \
+ __size = ceph_san_cnt(__VA_ARGS__); \
} \
- ceph_san_log(__source_id, fmt, ##__VA_ARGS__); \
+ ceph_san_log(__source_id, ##__VA_ARGS__); \
} while (0)
/* Global logger instance */
* @file: Source file name
* @func: Function name
* @line: Line number
+ * @fmt: Format string
*
* Returns a unique ID for this source location
*/
-u32 ceph_san_get_source_id(const char *file, const char *func, unsigned int line)
+u32 ceph_san_get_source_id(const char *file, const char *func, unsigned int line, const char *fmt)
{
u32 id = atomic_inc_return(&g_logger.next_source_id);
g_logger.source_map[id].file = file;
g_logger.source_map[id].func = func;
g_logger.source_map[id].line = line;
+ g_logger.source_map[id].fmt = fmt;
return id;
}
/**
* ceph_san_log - Log a message
* @source_id: Source ID for this location
- * @fmt: Format string
*
* Logs a message to the current TLS context's log buffer
+ * Format string is retrieved from the source_map
*/
-void ceph_san_log(u32 source_id, const char *fmt, ...)
+void ceph_san_log(u32 source_id, ...)
{
/* Format the message into local buffer first */
char buf[256];
va_list args;
u64 alloc;
int len, needed_size;
+ const struct ceph_san_source_info *source_info;
ctx = ceph_san_get_tls_ctx();
if (!ctx) {
return;
}
- va_start(args, fmt);
- len = vsnprintf(buf, sizeof(buf), fmt, args);
+ /* Get format string from source info */
+ source_info = ceph_san_get_source_info(source_id);
+ if (!source_info || !source_info->fmt) {
+ pr_err("Invalid source ID or missing format string\n");
+ return;
+ }
+
+ va_start(args, source_id);
+ len = vsnprintf(buf, sizeof(buf), source_info->fmt, args);
va_end(args);
needed_size = sizeof(*entry) + len + 1;
raw_pgid->pool = oloc->pool;
raw_pgid->seed = ceph_str_hash(pi->object_hash, oid->name,
oid->name_len);
- dout("%s %s -> raw_pgid %llu.%x\n", __func__, oid->name,
+ dout("%s -> raw_pgid %llu.%x\n", oid->name,
raw_pgid->pool, raw_pgid->seed);
} else {
char stack_buf[256];
raw_pgid->seed = ceph_str_hash(pi->object_hash, buf, total);
if (buf != stack_buf)
kfree(buf);
- dout("%s %s ns %.*s -> raw_pgid %llu.%x\n", __func__,
- oid->name, nsl, oloc->pool_ns->str,
+ dout("%s ns %.*s -> raw_pgid %llu.%x\n",
+ oid->name, nsl, "FIXME -- POOL NS name",//oloc->pool_ns->str,
raw_pgid->pool, raw_pgid->seed);
}
}