summaryrefslogtreecommitdiff
path: root/sys/dev/softraid_raid5.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-04-04 18:48:40 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-04-04 18:48:40 +0000
commit920ebf8ac71d43445517fcb87fcc1a149478402e (patch)
tree29012a19ddc2698e55b6f8be4d873ddbc97f4c15 /sys/dev/softraid_raid5.c
parent9550b5c20eb6521c6be55ff7a01473d287609743 (diff)
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_raid5.c')
-rw-r--r--sys/dev/softraid_raid5.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/softraid_raid5.c b/sys/dev/softraid_raid5.c
index ee0c7fddc1b..bf886bba3a5 100644
--- a/sys/dev/softraid_raid5.c
+++ b/sys/dev/softraid_raid5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid5.c,v 1.23 2015/07/21 03:30:51 krw Exp $ */
+/* $OpenBSD: softraid_raid5.c,v 1.24 2016/04/04 18:48:39 krw Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
@@ -96,12 +96,22 @@ int
sr_raid5_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 < 3) {
sr_error(sd->sd_sc, "%s requires three or more chunks",
sd->sd_name);
return EINVAL;
}
+ secsize = sd->sd_vol.sv_chunks[0]->src_secsize;
+ 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.