[Midnightbsd-cvs] src [8901] trunk/sbin/hastd: add error counters to hastd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Sep 26 18:36:55 EDT 2016
Revision: 8901
http://svnweb.midnightbsd.org/src/?rev=8901
Author: laffer1
Date: 2016-09-26 18:36:55 -0400 (Mon, 26 Sep 2016)
Log Message:
-----------
add error counters to hastd
Modified Paths:
--------------
trunk/sbin/hastd/control.c
trunk/sbin/hastd/hast.h
trunk/sbin/hastd/primary.c
trunk/sbin/hastd/secondary.c
Modified: trunk/sbin/hastd/control.c
===================================================================
--- trunk/sbin/hastd/control.c 2016-09-26 22:36:32 UTC (rev 8900)
+++ trunk/sbin/hastd/control.c 2016-09-26 22:36:55 UTC (rev 8901)
@@ -207,6 +207,14 @@
"stat_flush%u", no);
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"),
"stat_activemap_update%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read_error"),
+ "stat_read_error%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write_error"),
+ "stat_write_error%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete_error"),
+ "stat_delete_error%u", no);
+ nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush_error"),
+ "stat_flush_error%u", no);
end:
if (cnvin != NULL)
nv_free(cnvin);
@@ -459,6 +467,16 @@
nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush");
nv_add_uint64(nvout, res->hr_stat_activemap_update,
"stat_activemap_update");
+ nv_add_uint64(nvout, res->hr_stat_read_error,
+ "stat_read_error");
+ nv_add_uint64(nvout, res->hr_stat_write_error +
+ res->hr_stat_activemap_write_error,
+ "stat_write_error");
+ nv_add_uint64(nvout, res->hr_stat_delete_error,
+ "stat_delete_error");
+ nv_add_uint64(nvout, res->hr_stat_flush_error +
+ res->hr_stat_activemap_flush_error,
+ "stat_flush_error");
nv_add_int16(nvout, 0, "error");
break;
case CONTROL_RELOAD:
Modified: trunk/sbin/hastd/hast.h
===================================================================
--- trunk/sbin/hastd/hast.h 2016-09-26 22:36:32 UTC (rev 8900)
+++ trunk/sbin/hastd/hast.h 2016-09-26 22:36:55 UTC (rev 8901)
@@ -234,6 +234,18 @@
uint64_t hr_stat_flush;
/* Number of activemap updates. */
uint64_t hr_stat_activemap_update;
+ /* Number of local read errors. */
+ uint64_t hr_stat_read_error;
+ /* Number of local write errors. */
+ uint64_t hr_stat_write_error;
+ /* Number of local delete errors. */
+ uint64_t hr_stat_delete_error;
+ /* Number of flush errors. */
+ uint64_t hr_stat_flush_error;
+ /* Number of activemap write errors. */
+ uint64_t hr_stat_activemap_write_error;
+ /* Number of activemap flush errors. */
+ uint64_t hr_stat_activemap_flush_error;
/* Next resource. */
TAILQ_ENTRY(hast_resource) hr_next;
Modified: trunk/sbin/hastd/primary.c
===================================================================
--- trunk/sbin/hastd/primary.c 2016-09-26 22:36:32 UTC (rev 8900)
+++ trunk/sbin/hastd/primary.c 2016-09-26 22:36:55 UTC (rev 8901)
@@ -303,6 +303,7 @@
if (pwrite(res->hr_localfd, buf, size, METADATA_SIZE) !=
(ssize_t)size) {
pjdlog_errno(LOG_ERR, "Unable to flush activemap to disk");
+ res->hr_stat_activemap_write_error++;
return (-1);
}
if (res->hr_metaflush == 1 && g_flush(res->hr_localfd) == -1) {
@@ -313,6 +314,7 @@
} else {
pjdlog_errno(LOG_ERR,
"Unable to flush disk cache on activemap update");
+ res->hr_stat_activemap_flush_error++;
return (-1);
}
}
@@ -1792,6 +1794,22 @@
"G_GATE_CMD_DONE failed");
}
}
+ if (hio->hio_errors[0]) {
+ switch (ggio->gctl_cmd) {
+ case BIO_READ:
+ res->hr_stat_read_error++;
+ break;
+ case BIO_WRITE:
+ res->hr_stat_write_error++;
+ break;
+ case BIO_DELETE:
+ res->hr_stat_delete_error++;
+ break;
+ case BIO_FLUSH:
+ res->hr_stat_flush_error++;
+ break;
+ }
+ }
pjdlog_debug(2,
"ggate_send: (%p) Moving request to the free queue.", hio);
QUEUE_INSERT2(hio, free);
Modified: trunk/sbin/hastd/secondary.c
===================================================================
--- trunk/sbin/hastd/secondary.c 2016-09-26 22:36:32 UTC (rev 8900)
+++ trunk/sbin/hastd/secondary.c 2016-09-26 22:36:55 UTC (rev 8901)
@@ -725,6 +725,7 @@
pjdlog_errno(LOG_WARNING,
"Unable to store cleared activemap");
free(map);
+ res->hr_stat_activemap_write_error++;
break;
}
free(map);
@@ -839,8 +840,23 @@
PJDLOG_ABORT("Unexpected command (cmd=%hhu).",
hio->hio_cmd);
}
- if (hio->hio_error != 0)
+ if (hio->hio_error != 0) {
+ switch (hio->hio_cmd) {
+ case HIO_READ:
+ res->hr_stat_read_error++;
+ break;
+ case HIO_WRITE:
+ res->hr_stat_write_error++;
+ break;
+ case HIO_DELETE:
+ res->hr_stat_delete_error++;
+ break;
+ case HIO_FLUSH:
+ res->hr_stat_flush_error++;
+ break;
+ }
nv_add_int16(nvout, hio->hio_error, "error");
+ }
if (hast_proto_send(res, res->hr_remoteout, nvout, data,
length) == -1) {
secondary_exit(EX_TEMPFAIL, "Unable to send reply");
More information about the Midnightbsd-cvs
mailing list