diff options
Diffstat (limited to 'sys/dev/softraid_raid1.c')
-rw-r--r-- | sys/dev/softraid_raid1.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c index 4bb766bf550..5a6e2b21254 100644 --- a/sys/dev/softraid_raid1.c +++ b/sys/dev/softraid_raid1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid1.c,v 1.63 2015/07/21 03:30:51 krw Exp $ */ +/* $OpenBSD: softraid_raid1.c,v 1.64 2016/04/04 18:48:39 krw Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * @@ -76,12 +76,21 @@ int sr_raid1_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; sd->sd_meta->ssdi.ssd_size = coerced_size; return sr_raid1_init(sd); |