#include "common/ceph_context.h"
#include "global/global_context.h"
+#include <string.h>
+
+
/*
* Global variables for use from process context.
*/
const char *g_assert_func = 0;
const char *g_assert_condition = 0;
unsigned long long g_assert_thread = 0;
-char g_assert_thread_name[4096];
-char g_assert_msg[8096];
-char g_process_name[NAME_MAX + 1];
+char g_assert_thread_name[4096] = { 0 };
+char g_assert_msg[8096] = { 0 };
+char g_process_name[NAME_MAX + 1] = { 0 };
+
+bool g_eio = false;
+char g_eio_devname[1024] = { 0 };
+char g_eio_path[PATH_MAX] = { 0 };
+int g_eio_error = 0; // usually -EIO...
+int g_eio_iotype = 0; // 1 = read, 2 = write
+unsigned long long g_eio_offset = 0;
+unsigned long long g_eio_length = 0;
+
+int note_io_error_event(
+ const char *devname,
+ const char *path,
+ int error,
+ int iotype,
+ unsigned long long offset,
+ unsigned long long length)
+{
+ g_eio = true;
+ if (devname) {
+ strncpy(g_eio_devname, devname, sizeof(g_eio_devname));
+ }
+ if (path) {
+ strncpy(g_eio_path, path, sizeof(g_eio_path));
+ }
+ g_eio_error = error;
+ g_eio_iotype = iotype;
+ g_eio_offset = offset;
+ g_eio_length = length;
+ return 0;
+}
extern char g_assert_msg[8096];
extern char g_process_name[NAME_MAX + 1];
+extern bool g_eio;
+extern char g_eio_devname[1024];
+extern char g_eio_path[PATH_MAX];
+extern int g_eio_error;
+extern int g_eio_iotype; // IOCB_CMD_* from libaio's aio_abh.io
+extern unsigned long long g_eio_offset;
+extern unsigned long long g_eio_length;
+
+extern int note_io_error_event(
+ const char *devname,
+ const char *path,
+ int error,
+ int iotype,
+ unsigned long long offset,
+ unsigned long long length);
+
#endif
jf.dump_string("assert_msg", g_assert_msg);
}
+ // eio?
+ if (g_eio) {
+ jf.dump_bool("io_error", true);
+ if (g_eio_devname[0]) {
+ jf.dump_string("io_error_devname", g_eio_devname);
+ }
+ if (g_eio_path[0]) {
+ jf.dump_string("io_error_path", g_eio_path);
+ }
+ if (g_eio_error) {
+ jf.dump_int("io_error_code", g_eio_error);
+ }
+ if (g_eio_iotype) {
+ jf.dump_int("io_error_optype", g_eio_iotype);
+ }
+ if (g_eio_offset) {
+ jf.dump_unsigned("io_error_offset", g_eio_offset);
+ }
+ if (g_eio_length) {
+ jf.dump_unsigned("io_error_length", g_eio_length);
+ }
+ }
+
// backtrace
bt.dump(&jf);