summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-03-25 16:01:50 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-03-25 16:01:50 +0000
commit70f9a624f789799fd8f194e22c02586549b30e9b (patch)
tree68ae4bb668bd63f83717a5e50dfdb95b47943623
parent8719864660c5c508599035e11298e4116b707f6d (diff)
Factor out the code that is used to recreate work units - one copy of the
code is sufficient. ok krw@
-rw-r--r--sys/dev/softraid.c24
-rw-r--r--sys/dev/softraid_raid1.c26
-rw-r--r--sys/dev/softraid_raid6.c26
-rw-r--r--sys/dev/softraid_raidp.c26
-rw-r--r--sys/dev/softraidvar.h3
5 files changed, 31 insertions, 74 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 5c23b464ce7..74d7f37a6fb 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.290 2013/03/10 09:05:12 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.291 2013/03/25 16:01:48 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -4128,6 +4128,28 @@ sr_raid_startwu(struct sr_workunit *wu)
}
void
+sr_raid_recreate_wu(struct sr_workunit *wu)
+{
+ struct sr_discipline *sd = wu->swu_dis;
+ struct sr_workunit *wup = wu;
+
+ /*
+ * Recreate a work unit by releasing the associated CCBs and reissuing
+ * the SCSI I/O request. This process is then repeated for all of the
+ * colliding work units.
+ */
+ do {
+ sr_wu_release_ccbs(wup);
+
+ wup->swu_state = SR_WU_REQUEUE;
+ if (sd->sd_scsi_rw(wup))
+ panic("could not requeue I/O");
+
+ wup = wup->swu_collider;
+ } while (wup);
+}
+
+void
sr_set_chunk_state(struct sr_discipline *sd, int c, int new_state)
{
int old_state, s;
diff --git a/sys/dev/softraid_raid1.c b/sys/dev/softraid_raid1.c
index 9d74a0109d4..d430ae10a4c 100644
--- a/sys/dev/softraid_raid1.c
+++ b/sys/dev/softraid_raid1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid1.c,v 1.41 2013/03/02 12:50:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid1.c,v 1.42 2013/03/25 16:01:49 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -52,7 +52,6 @@ int sr_raid1_alloc_resources(struct sr_discipline *);
int sr_raid1_free_resources(struct sr_discipline *);
int sr_raid1_rw(struct sr_workunit *);
void sr_raid1_intr(struct buf *);
-void sr_raid1_recreate_wu(struct sr_workunit *);
void sr_raid1_set_chunk_state(struct sr_discipline *, int, int);
void sr_raid1_set_vol_state(struct sr_discipline *);
@@ -521,7 +520,7 @@ sr_raid1_intr(struct buf *bp)
if (wu->swu_collider) {
if (wu->swu_ios_failed)
/* toss all ccbs and recreate */
- sr_raid1_recreate_wu(wu->swu_collider);
+ sr_raid_recreate_wu(wu->swu_collider);
/* restart deferred wu */
wu->swu_collider->swu_state =
@@ -565,24 +564,3 @@ bad:
splx(s);
}
-
-void
-sr_raid1_recreate_wu(struct sr_workunit *wu)
-{
- struct sr_discipline *sd = wu->swu_dis;
- struct sr_workunit *wup = wu;
-
- do {
- DNPRINTF(SR_D_INTR, "%s: sr_raid1_recreate_wu: %p\n", wup);
-
- /* toss all ccbs */
- sr_wu_release_ccbs(wup);
-
- /* recreate ccbs */
- wup->swu_state = SR_WU_REQUEUE;
- if (sd->sd_scsi_rw(wup))
- panic("could not requeue io");
-
- wup = wup->swu_collider;
- } while (wup);
-}
diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c
index 85a68e1be2a..0904859cea1 100644
--- a/sys/dev/softraid_raid6.c
+++ b/sys/dev/softraid_raid6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid6.c,v 1.34 2013/03/02 12:50:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid6.c,v 1.35 2013/03/25 16:01:49 jsing Exp $ */
/*
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org>
@@ -58,7 +58,6 @@ int sr_raid6_free_resources(struct sr_discipline *);
int sr_raid6_rw(struct sr_workunit *);
int sr_raid6_openings(struct sr_discipline *);
void sr_raid6_intr(struct buf *);
-void sr_raid6_recreate_wu(struct sr_workunit *);
void sr_raid6_set_chunk_state(struct sr_discipline *, int, int);
void sr_raid6_set_vol_state(struct sr_discipline *);
@@ -809,7 +808,7 @@ sr_raid6_intr(struct buf *bp)
if (wu->swu_collider) {
if (wu->swu_ios_failed)
/* toss all ccbs and recreate */
- sr_raid6_recreate_wu(wu->swu_collider);
+ sr_raid_recreate_wu(wu->swu_collider);
/* restart deferred wu */
wu->swu_collider->swu_state =
@@ -858,27 +857,6 @@ bad:
splx(s);
}
-void
-sr_raid6_recreate_wu(struct sr_workunit *wu)
-{
- struct sr_discipline *sd = wu->swu_dis;
- struct sr_workunit *wup = wu;
-
- do {
- DNPRINTF(SR_D_INTR, "%s: sr_raid6_recreate_wu: %p\n", wup);
-
- /* toss all ccbs */
- sr_wu_release_ccbs(wup);
-
- /* recreate ccbs */
- wup->swu_state = SR_WU_REQUEUE;
- if (sd->sd_scsi_rw(wup))
- panic("could not requeue io");
-
- wup = wup->swu_collider;
- } while (wup);
-}
-
int
sr_raid6_addio(struct sr_workunit *wu, int dsk, daddr64_t blk, daddr64_t len,
void *data, int flag, int ccbflag, void *pbuf, void *qbuf, int gn)
diff --git a/sys/dev/softraid_raidp.c b/sys/dev/softraid_raidp.c
index 6f65e97dfc6..73918d3d66d 100644
--- a/sys/dev/softraid_raidp.c
+++ b/sys/dev/softraid_raidp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raidp.c,v 1.31 2013/03/02 12:50:01 jsing Exp $ */
+/* $OpenBSD: softraid_raidp.c,v 1.32 2013/03/25 16:01:49 jsing Exp $ */
/*
* Copyright (c) 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org>
@@ -54,7 +54,6 @@ int sr_raidp_free_resources(struct sr_discipline *);
int sr_raidp_rw(struct sr_workunit *);
int sr_raidp_openings(struct sr_discipline *);
void sr_raidp_intr(struct buf *);
-void sr_raidp_recreate_wu(struct sr_workunit *);
void sr_raidp_set_chunk_state(struct sr_discipline *, int, int);
void sr_raidp_set_vol_state(struct sr_discipline *);
@@ -626,7 +625,7 @@ sr_raidp_intr(struct buf *bp)
if (wu->swu_collider) {
if (wu->swu_ios_failed)
/* toss all ccbs and recreate */
- sr_raidp_recreate_wu(wu->swu_collider);
+ sr_raid_recreate_wu(wu->swu_collider);
/* restart deferred wu */
wu->swu_collider->swu_state =
@@ -674,27 +673,6 @@ bad:
splx(s);
}
-void
-sr_raidp_recreate_wu(struct sr_workunit *wu)
-{
- struct sr_discipline *sd = wu->swu_dis;
- struct sr_workunit *wup = wu;
-
- do {
- DNPRINTF(SR_D_INTR, "%s: sr_raidp_recreate_wu: %p\n", wup);
-
- /* toss all ccbs */
- sr_wu_release_ccbs(wup);
-
- /* recreate ccbs */
- wup->swu_state = SR_WU_REQUEUE;
- if (sd->sd_scsi_rw(wup))
- panic("could not requeue io");
-
- wup = wup->swu_collider;
- } while (wup);
-}
-
int
sr_raidp_addio(struct sr_workunit *wu, int dsk, daddr64_t blk, daddr64_t len,
void *data, int flag, int ccbflag, void *xorbuf)
diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h
index 18bc5135153..7aa0c5353da 100644
--- a/sys/dev/softraidvar.h
+++ b/sys/dev/softraidvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraidvar.h,v 1.128 2013/03/10 09:05:12 jsing Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.129 2013/03/25 16:01:49 jsing Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -697,6 +697,7 @@ int sr_raid_request_sense( struct sr_workunit *);
int sr_raid_start_stop(struct sr_workunit *);
int sr_raid_sync(struct sr_workunit *);
void sr_raid_startwu(struct sr_workunit *);
+void sr_raid_recreate_wu(struct sr_workunit *);
/* Discipline specific initialisation. */
void sr_raid0_discipline_init(struct sr_discipline *);