1 Star 0 Fork 32

hongrongxuan/rasdaemon

forked from src-openEuler/rasdaemon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-rasdaemon-diskerror-fix-incomplete-diskerror-log.patch 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
zhuofeng 提交于 2024-01-30 15:16 . update version to 0.8.0
From 57e082edfe2651fc09035a7d9227be57ab9b8a06 Mon Sep 17 00:00:00 2001
From: Lv Ying <lvying6@huawei.com>
Date: Thu, 15 Dec 2022 21:01:59 +0800
Subject: [PATCH 1/2] rasdaemon/diskerror: fix incomplete diskerror log
Currently, rasdaemon output incomplete diskerror log(only contains timestamp):
<idle>-0 [000] 0.017915: block_rq_complete: 2022-12-16 04:17:32 +0800
Fix incomplete diskerror log just like block_rq_complete tracepoint output format:
<idle>-0 [042] d.h. 177962.715669: block_rq_complete: 21,0 N () 18446744073709551615 + 0 [-121]
---
ras-diskerror-handler.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/ras-diskerror-handler.c b/ras-diskerror-handler.c
index 638cb4d..82e8ec0 100644
--- a/ras-diskerror-handler.c
+++ b/ras-diskerror-handler.c
@@ -97,26 +97,32 @@ int ras_diskerror_event_handler(struct trace_seq *s,
dev = (dev_t)val;
if (asprintf(&ev.dev, "%u:%u", major(dev), minor(dev)) < 0)
return -1;
+ trace_seq_printf(s, "%s ", ev.dev);
+
+ ev.rwbs = tep_get_field_raw(s, event, "rwbs", record, &len, 1);
+ if (!ev.rwbs)
+ return -1;
+ trace_seq_printf(s, "%s ", ev.rwbs);
+
+ ev.cmd = tep_get_field_raw(s, event, "cmd", record, &len, 1);
+ if (!ev.cmd)
+ return -1;
+ trace_seq_printf(s, "(%s) ", ev.cmd);
if (tep_get_field_val(s, event, "sector", record, &val, 1) < 0)
return -1;
ev.sector = val;
+ trace_seq_printf(s, "%llu ", ev.sector);
if (tep_get_field_val(s, event, "nr_sector", record, &val, 1) < 0)
return -1;
ev.nr_sector = (unsigned int)val;
+ trace_seq_printf(s, "+ %u ", ev.nr_sector);
if (tep_get_field_val(s, event, "error", record, &val, 1) < 0)
return -1;
ev.error = get_blk_error((int)val);
-
- ev.rwbs = tep_get_field_raw(s, event, "rwbs", record, &len, 1);
- if (!ev.rwbs)
- return -1;
-
- ev.cmd = tep_get_field_raw(s, event, "cmd", record, &len, 1);
- if (!ev.cmd)
- return -1;
+ trace_seq_printf(s, "[%s]", ev.error);
/* Insert data into the SGBD */
#ifdef HAVE_SQLITE3
--
2.30.3
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/barbo/rasdaemon.git
git@gitee.com:barbo/rasdaemon.git
barbo
rasdaemon
rasdaemon
master

搜索帮助