summaryrefslogtreecommitdiff
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2010-02-13 21:16:11 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2010-02-13 21:16:11 +0000
commitac37319884fe5d0ddb8e8ec4a7258bba5a5f2ae5 (patch)
tree389758adcd6e505a55c569da98815cda98b6ab55 /sys/dev/softraid.c
parentec703c238e105be7f3884a14b484aa9624def8d0 (diff)
Pass the number of chunks to sr_meta_attach() rather than recalculating.
ok marco@
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index f51f8ad03d9..654e6fd5d17 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.190 2010/02/08 23:28:06 krw Exp $ */
+/* $OpenBSD: softraid.c,v 1.191 2010/02/13 21:16:10 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -135,7 +135,7 @@ void sr_sensors_delete(struct sr_discipline *);
/* metadata */
int sr_meta_probe(struct sr_discipline *, dev_t *, int);
-int sr_meta_attach(struct sr_discipline *, int);
+int sr_meta_attach(struct sr_discipline *, int, int);
int sr_meta_rw(struct sr_discipline *, dev_t, void *,
size_t, daddr64_t, long);
int sr_meta_clear(struct sr_discipline *);
@@ -208,7 +208,7 @@ struct sr_meta_driver {
};
int
-sr_meta_attach(struct sr_discipline *sd, int force)
+sr_meta_attach(struct sr_discipline *sd, int chunk_no, int force)
{
struct sr_softc *sc = sd->sd_sc;
struct sr_chunk_head *cl;
@@ -239,10 +239,7 @@ sr_meta_attach(struct sr_discipline *sd, int force)
/* we have a valid list now create an array index */
cl = &sd->sd_vol.sv_chunk_list;
- SLIST_FOREACH(ch_entry, cl, src_link) {
- i++;
- }
- sd->sd_vol.sv_chunks = malloc(sizeof(struct sr_chunk *) * i,
+ sd->sd_vol.sv_chunks = malloc(sizeof(struct sr_chunk *) * chunk_no,
M_DEVBUF, M_WAITOK | M_ZERO);
/* fill out chunk array */
@@ -2769,7 +2766,7 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
goto unwind;
}
- if (sr_meta_attach(sd, bc->bc_flags & BIOC_SCFORCE)) {
+ if (sr_meta_attach(sd, no_chunk, bc->bc_flags & BIOC_SCFORCE)) {
printf("%s: can't attach metadata type %d\n", DEVNAME(sc),
sd->sd_meta_type);
goto unwind;