summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-01-21 04:23:15 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-01-21 04:23:15 +0000
commit953638cc8846a29c02540e20dd9853c829ca9718 (patch)
tree759867e3fd42866efa563bc82bdedb5d6747af3a
parent6a1ff8d639b92f307576af464171c2db96425196 (diff)
Allow for variable sized work units.
ok krw@
-rw-r--r--sys/dev/softraid.c9
-rw-r--r--sys/dev/softraid_aoe.c4
-rw-r--r--sys/dev/softraid_crypto.c4
-rw-r--r--sys/dev/softraidvar.h4
4 files changed, 10 insertions, 11 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 002ef5bb6c8..fc80c98bc6f 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.323 2014/01/21 03:50:44 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.324 2014/01/21 04:23:14 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -2102,7 +2102,7 @@ sr_ccb_done(struct sr_ccb *ccb)
}
int
-sr_wu_alloc(struct sr_discipline *sd)
+sr_wu_alloc(struct sr_discipline *sd, int wu_size)
{
struct sr_workunit *wu;
int i, no_wu;
@@ -2120,8 +2120,7 @@ sr_wu_alloc(struct sr_discipline *sd)
TAILQ_INIT(&sd->sd_wu_defq);
for (i = 0; i < no_wu; i++) {
- wu = malloc(sizeof(struct sr_workunit),
- M_DEVBUF, M_WAITOK | M_ZERO);
+ wu = malloc(wu_size, M_DEVBUF, M_WAITOK | M_ZERO);
TAILQ_INSERT_TAIL(&sd->sd_wu, wu, swu_next);
TAILQ_INIT(&wu->swu_ccb);
task_set(&wu->swu_task, sr_wu_done_callback, sd, wu);
@@ -4259,7 +4258,7 @@ sr_raid_recreate_wu(struct sr_workunit *wu)
int
sr_alloc_resources(struct sr_discipline *sd)
{
- if (sr_wu_alloc(sd)) {
+ if (sr_wu_alloc(sd, sizeof(struct sr_workunit))) {
sr_error(sd->sd_sc, "unable to allocate work units");
return (ENOMEM);
}
diff --git a/sys/dev/softraid_aoe.c b/sys/dev/softraid_aoe.c
index 3380f735b29..95a7cb805b2 100644
--- a/sys/dev/softraid_aoe.c
+++ b/sys/dev/softraid_aoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_aoe.c,v 1.35 2013/11/21 16:34:50 krw Exp $ */
+/* $OpenBSD: softraid_aoe.c,v 1.36 2014/01/21 04:23:14 jsing Exp $ */
/*
* Copyright (c) 2008 Ted Unangst <tedu@openbsd.org>
* Copyright (c) 2008 Marco Peereboom <marco@openbsd.org>
@@ -248,7 +248,7 @@ sr_aoe_alloc_resources(struct sr_discipline *sd)
DNPRINTF(SR_D_DIS, "%s: sr_aoe_alloc_resources\n",
DEVNAME(sd->sd_sc));
- sr_wu_alloc(sd);
+ sr_wu_alloc(sd, sizeof(struct sr_workunit));
sr_ccb_alloc(sd);
return 0;
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index f4250f16fb1..50def6afef6 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.103 2014/01/21 03:21:38 jsing Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.104 2014/01/21 04:23:14 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -955,7 +955,7 @@ sr_crypto_alloc_resources(struct sr_discipline *sd)
for (i = 0; i < SR_CRYPTO_MAXKEYS; i++)
sd->mds.mdd_crypto.scr_sid[i] = (u_int64_t)-1;
- if (sr_wu_alloc(sd)) {
+ if (sr_wu_alloc(sd, sizeof(struct sr_workunit))) {
sr_error(sd->sd_sc, "unable to allocate work units");
return (ENOMEM);
}
diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h
index 60e16544bf4..eead2937b83 100644
--- a/sys/dev/softraidvar.h
+++ b/sys/dev/softraidvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraidvar.h,v 1.148 2014/01/21 03:50:44 jsing Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.149 2014/01/21 04:23:14 jsing Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -659,7 +659,7 @@ void sr_ccb_put(struct sr_ccb *);
struct sr_ccb *sr_ccb_rw(struct sr_discipline *, int, daddr_t,
daddr_t, u_int8_t *, int, int);
void sr_ccb_done(struct sr_ccb *);
-int sr_wu_alloc(struct sr_discipline *);
+int sr_wu_alloc(struct sr_discipline *, int);
void sr_wu_free(struct sr_discipline *);
void *sr_wu_get(void *);
void sr_wu_put(void *, void *);