From b4ebb02af54257d582b9e9d823dbaab5bad63fb7 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 5 Jan 2010 13:25:12 +0000 Subject: [PATCH] For completeness, add -s argument, manually specifying array block size. --- sbin/geom/class/raid3/geom_raid3.c | 7 +++++-- sbin/geom/class/raid3/graid3.8 | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sbin/geom/class/raid3/geom_raid3.c b/sbin/geom/class/raid3/geom_raid3.c index 4a2dbe201ef2..89ce1689ba83 100644 --- a/sbin/geom/class/raid3/geom_raid3.c +++ b/sbin/geom/class/raid3/geom_raid3.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_RAID3_VERSION; +static intmax_t default_blocksize = 0; + static void raid3_main(struct gctl_req *req, unsigned f); static void raid3_clear(struct gctl_req *req); static void raid3_dump(struct gctl_req *req); @@ -87,10 +89,11 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, { 'r', "round_robin", NULL, G_TYPE_BOOL }, + { 's', "blocksize", &default_blocksize, G_TYPE_NUMBER }, { 'w', "verify", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - NULL, "[-hFnrvw] name prov prov prov ..." + NULL, "[-hFnrvw] [-s blocksize] name prov prov prov ..." }, { "rebuild", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, "[-v] name prov" @@ -190,7 +193,7 @@ raid3_label(struct gctl_req *req) * sectorsizes of every disk and find the smallest mediasize. */ mediasize = 0; - sectorsize = 0; + sectorsize = gctl_get_intmax(req, "blocksize"); for (i = 1; i < nargs; i++) { str = gctl_get_ascii(req, "arg%d", i); msize = g_get_mediasize(str); diff --git a/sbin/geom/class/raid3/graid3.8 b/sbin/geom/class/raid3/graid3.8 index 21c6f181e773..f9ea0cace592 100644 --- a/sbin/geom/class/raid3/graid3.8 +++ b/sbin/geom/class/raid3/graid3.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2006 +.Dd January 5, 2010 .Dt GRAID3 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm .Cm label .Op Fl Fhnrvw +.Op Fl s Ar blocksize .Ar name .Ar prov prov prov ... .Nm @@ -113,6 +114,12 @@ but sequential reads are slower. One cannot use this option if the .Fl w option is also specified. +.It Fl s +Manually specify array block size. Block size will be set equal to least +common multiple of all component's sector sizes and specified value. +Note that array sector size calculated as multiple of block size and number +of regular data components. Big values may decrease performance and compatibility, +as all I/O requests have to be multiple of sector size. .It Fl w Use verify reading feature. When reading from a device in a complete state, also read data from the parity component