summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid_concat.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_concat.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_concat.c')
-rw-r--r--sys/dev/softraid_concat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/softraid_concat.c b/sys/dev/softraid_concat.c
index b6ac55eb281..be770d4a23d 100644
--- a/sys/dev/softraid_concat.c
+++ b/sys/dev/softraid_concat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_concat.c,v 1.23 2015/07/21 03:30:51 krw Exp $ */
+/* $OpenBSD: softraid_concat.c,v 1.24 2016/04/04 18:48:39 krw Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2011 Joel Sing <jsing@openbsd.org>
@@ -61,6 +61,7 @@ sr_concat_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",
@@ -69,9 +70,14 @@ sr_concat_create(struct sr_discipline *sd, struct bioc_createraid *bc,
}
sd->sd_meta->ssdi.ssd_size = 0;
- for (i = 0; i < no_chunk; i++)
+ 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_size +=
sd->sd_vol.sv_chunks[i]->src_size;
+ }
+ sd->sd_meta->ssdi.ssd_secsize = secsize;
return sr_concat_init(sd);
}