diff options
author | pjd <pjd@FreeBSD.org> | 2004-08-22 16:21:12 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-08-22 16:21:12 +0000 |
commit | 7e2ef21ad90efdeb778bd1faea580f1c1687ffe6 (patch) | |
tree | de1c132fb71dfe957365121a3a93c74acfc8a7f0 /sbin/geom/class | |
parent | be94cde364f800cf85113f772c600382765a7361 (diff) | |
download | FreeBSD-src-7e2ef21ad90efdeb778bd1faea580f1c1687ffe6.zip FreeBSD-src-7e2ef21ad90efdeb778bd1faea580f1c1687ffe6.tar.gz |
Implementation of 'verify reading' algorithm, which uses parity data for
verification of regular data when device is in complete state.
On verification error, EIO error is returned for the bio and sysctl
kern.geom.raid3.stat.parity_mismatch is increased.
Suggested by: phk
Diffstat (limited to 'sbin/geom/class')
-rw-r--r-- | sbin/geom/class/raid3/geom_raid3.c | 20 | ||||
-rw-r--r-- | sbin/geom/class/raid3/graid3.8 | 25 |
2 files changed, 39 insertions, 6 deletions
diff --git a/sbin/geom/class/raid3/geom_raid3.c b/sbin/geom/class/raid3/geom_raid3.c index c7120ed..8e507ec 100644 --- a/sbin/geom/class/raid3/geom_raid3.c +++ b/sbin/geom/class/raid3/geom_raid3.c @@ -60,6 +60,8 @@ struct g_command class_commands[] = { { 'n', "noautosync", NULL, G_TYPE_NONE }, { 'r', "round_robin", NULL, G_TYPE_NONE }, { 'R', "noround_robin", NULL, G_TYPE_NONE }, + { 'w', "verify", NULL, G_TYPE_NONE }, + { 'W', "noverify", NULL, G_TYPE_NONE }, G_OPT_SENTINEL } }, @@ -76,6 +78,7 @@ struct g_command class_commands[] = { { 'h', "hardcode", NULL, G_TYPE_NONE }, { 'n', "noautosync", NULL, G_TYPE_NONE }, { 'r', "round_robin", NULL, G_TYPE_NONE }, + { 'w', "verify", NULL, G_TYPE_NONE }, G_OPT_SENTINEL } }, @@ -102,10 +105,10 @@ void usage(const char *comm) { fprintf(stderr, - "usage: %s label [-hnrv] name prov prov prov [prov [...]]\n" + "usage: %s label [-hnrvw] name prov prov prov [prov [...]]\n" " %s clear [-v] prov [prov [...]]\n" " %s dump prov [prov [...]]\n" - " %s configure [-adhnrRv] name\n" + " %s configure [-adhnrRvwW] name\n" " %s rebuild [-v] name prov\n" " %s insert [-hv] <-n number> name prov\n" " %s remove [-v] <-n number> name\n" @@ -144,7 +147,7 @@ raid3_label(struct gctl_req *req) u_char sector[512]; const char *str; char param[16]; - int *hardcode, *nargs, *noautosync, *round_robin; + int *hardcode, *nargs, *noautosync, *round_robin, *verify; int error, i; unsigned sectorsize; off_t mediasize; @@ -195,6 +198,17 @@ raid3_label(struct gctl_req *req) } if (*round_robin) md.md_mflags |= G_RAID3_DEVICE_FLAG_ROUND_ROBIN; + verify = gctl_get_paraml(req, "verify", sizeof(*verify)); + if (verify == NULL) { + gctl_error(req, "No '%s' argument.", "verify"); + return; + } + if (*verify) + md.md_mflags |= G_RAID3_DEVICE_FLAG_VERIFY; + if (*round_robin && *verify) { + gctl_error(req, "Both '%c' and '%c' options given.", 'r', 'w'); + return; + } hardcode = gctl_get_paraml(req, "hardcode", sizeof(*hardcode)); if (hardcode == NULL) { gctl_error(req, "No '%s' argument.", "hardcode"); diff --git a/sbin/geom/class/raid3/graid3.8 b/sbin/geom/class/raid3/graid3.8 index 713f979..47a30f4 100644 --- a/sbin/geom/class/raid3/graid3.8 +++ b/sbin/geom/class/raid3/graid3.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Aug 20, 2004 +.Dd Aug 22, 2004 .Dt GRAID3 8 .Os .Sh NAME @@ -33,7 +33,7 @@ .Sh SYNOPSIS .Nm .Cm label -.Op Fl hnrv +.Op Fl hnrvw .Ar name .Ar prov .Ar prov @@ -46,7 +46,7 @@ .Op Ar prov Op Ar ... .Nm .Cm configure -.Op Fl adhnrRv +.Op Fl adhnrRvwW .Ar name .Nm .Cm rebuild @@ -112,6 +112,21 @@ Without this option parity component is not used at all for reading operations when device is in complete state. With this option specified random I/O read operations are even 40% faster, but sequential reads are slower. +One cannot not use this options if +.Fl w +option is also specified. +.It Fl w +Use verify reading feature. +When reading from device in complete state, read data also from parity component +and verify the data by comparing XORed regular data with parity data. +If verification fails, +.Er EIO +error is returned and value of sysctl +.Va kern.geom.raid3.parity_mismatch +is increased. +One cannot not use this options if +.Fl r +option is also specified. .El .It Cm clear Clear metadata on the given providers. @@ -132,6 +147,10 @@ Turn off autosynchronization of stale components. Turn on round-robin reading. .It Fl R Turn off round-robin reading. +.It Fl w +Turn on verify reading. +.It Fl W +Turn off verify reading. .El .It Cm rebuild Rebuild the given component forcibly. |