summaryrefslogtreecommitdiffstats
path: root/sys/dev/softraid.c
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2020-12-16 18:16:34 +0000
committercheloha <cheloha@openbsd.org>2020-12-16 18:16:34 +0000
commit632f6d33e44d5b2ddbdbcba22f5f842c5f30ce4c (patch)
tree0ed01f6a1d2a81c56aad74e651fbfa7ac791b2ba /sys/dev/softraid.c
parentFail to parse rules with invalid ranges (diff)
downloadwireguard-openbsd-632f6d33e44d5b2ddbdbcba22f5f842c5f30ce4c.tar.xz
wireguard-openbsd-632f6d33e44d5b2ddbdbcba22f5f842c5f30ce4c.zip
softraid(4): more tsleep(9) -> tsleep_nsec(9) conversions
These wait loops block for up to 1 tick per iteration. I think they will continue to work if we block for at least 1ms per iteration. My gut says that these could be rewritten not to spin and instead to await a wakeup(9) from the other thread, but I think that would involve making softraid(4) more MP-safe.
Diffstat (limited to 'sys/dev/softraid.c')
-rw-r--r--sys/dev/softraid.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index aac33da065f..2aac992921c 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.416 2020/10/15 00:13:47 krw Exp $ */
+/* $OpenBSD: softraid.c,v 1.417 2020/12/16 18:16:34 cheloha Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -3885,7 +3885,7 @@ sr_discipline_shutdown(struct sr_discipline *sd, int meta_save, int dying)
if (sd->sd_reb_active) {
sd->sd_reb_abort = 1;
while (sd->sd_reb_active)
- tsleep(sd, PWAIT, "sr_shutdown", 1);
+ tsleep_nsec(sd, PWAIT, "sr_shutdown", MSEC_TO_NSEC(1));
}
if (meta_save)
@@ -4765,7 +4765,7 @@ sr_rebuild(struct sr_discipline *sd)
}
/* yield if we didn't sleep */
if (slept == 0)
- tsleep(sc, PWAIT, "sr_yield", 1);
+ tsleep_nsec(sc, PWAIT, "sr_yield", MSEC_TO_NSEC(1));
sr_scsi_wu_put(sd, wu_r);
sr_scsi_wu_put(sd, wu_w);