summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid_raid0.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2016-04-04 18:48:39 +0000
committerkrw <krw@openbsd.org>2016-04-04 18:48:39 +0000
commitbccb2f381f59c1825a61741f7afc2396d598d7e6 (patch)
tree6d7a700ba4ff8f3203a21099ff0b37b9c3d90b19 /sys/dev/softraid_raid0.c
parentFix memory leak. Call proto_free() always to free proto. (diff)
downloadwireguard-openbsd-bccb2f381f59c1825a61741f7afc2396d598d7e6.tar.xz
wireguard-openbsd-bccb2f381f59c1825a61741f7afc2396d598d7e6.zip
Enable creation of softraid volumes using disks with non-512 byte
sectors. Volumes created will present a sector size equal to the largest sector size of the constituent disks. Softraid Metadata version cranks to 6 due to new field. ok jsing@ with tweaks that will follow soon.
Diffstat (limited to 'sys/dev/softraid_raid0.c')
-rw-r--r--sys/dev/softraid_raid0.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c
index fa0c6f076b1..f5d0af286f3 100644
--- a/sys/dev/softraid_raid0.c
+++ b/sys/dev/softraid_raid0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid0.c,v 1.50 2015/07/21 03:30:51 krw Exp $ */
+/* $OpenBSD: softraid_raid0.c,v 1.51 2016/04/04 18:48:39 krw Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
*
@@ -69,12 +69,22 @@ int
sr_raid0_create(struct sr_discipline *sd, struct bioc_createraid *bc,
int no_chunk, int64_t coerced_size)
{
+ int i;
+ u_int32_t secsize;
+
if (no_chunk < 2) {
sr_error(sd->sd_sc, "%s requires two or more chunks",
sd->sd_name);
return EINVAL;
}
+ secsize = 0;
+ for (i = 0; i < no_chunk; i++) {
+ if (sd->sd_vol.sv_chunks[i]->src_secsize > secsize)
+ secsize = sd->sd_vol.sv_chunks[i]->src_secsize;
+ }
+ sd->sd_meta->ssdi.ssd_secsize = secsize;
+
/*
* XXX add variable strip size later even though MAXPHYS is really
* the clever value, users like to tinker with that type of stuff.