summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2013-10-23 13:05:38 +0000
committerkettenis <kettenis@openbsd.org>2013-10-23 13:05:38 +0000
commitcc7111842be7d7c3dc237f78cb716e0ffbe30d23 (patch)
tree5c80330bd0d6aaedd2d0e06c91ee9331c9783d4c
parentKey to swap to other end of selection (bound to o with vi keys), from J (diff)
downloadwireguard-openbsd-cc7111842be7d7c3dc237f78cb716e0ffbe30d23.tar.xz
wireguard-openbsd-cc7111842be7d7c3dc237f78cb716e0ffbe30d23.zip
Add support for displaying the cache write policy of RAID volumes to bioctl(8)
and make mfi(4) pass up the necessary information. Adding support for other RAID controllers is left as an excercise to the reader. ok deraadt@
-rw-r--r--sbin/bioctl/bioctl.c20
-rw-r--r--sys/dev/biovar.h9
-rw-r--r--sys/dev/ic/mfi.c7
3 files changed, 30 insertions, 6 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c
index 26187f09e1d..43b3b5c6ca1 100644
--- a/sbin/bioctl/bioctl.c
+++ b/sbin/bioctl/bioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioctl.c,v 1.112 2012/09/10 11:28:47 jsing Exp $ */
+/* $OpenBSD: bioctl.c,v 1.113 2013/10/23 13:05:38 kettenis Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@@ -334,7 +334,8 @@ bio_status(struct bio_status *bs)
void
bio_inq(char *name)
{
- char *status, size[64], scsiname[16], volname[32];
+ char *status, *cache;
+ char size[64], scsiname[16], volname[32];
char percent[10], seconds[20];
int i, d, volheader, hotspare, unused;
char encname[16], serial[32];
@@ -409,6 +410,17 @@ bio_inq(char *name)
default:
status = BIOC_SVINVALID_S;
}
+ switch (bv.bv_cache) {
+ case BIOC_CVWRITEBACK:
+ cache = BIOC_CVWRITEBACK_S;
+ break;
+ case BIOC_CVWRITETHROUGH:
+ cache = BIOC_CVWRITETHROUGH_S;
+ break;
+ case BIOC_CVUNKNOWN:
+ default:
+ cache = BIOC_CVUNKNOWN_S;
+ }
snprintf(volname, sizeof volname, "%s %u",
bi.bi_dev, bv.bv_volid);
@@ -437,9 +449,9 @@ bio_inq(char *name)
percent, seconds);
break;
default:
- printf("%11s %-10s %14s %-7s RAID%u%s%s\n",
+ printf("%11s %-10s %14s %-7s RAID%u%s%s %s\n",
volname, status, size, bv.bv_dev,
- bv.bv_level, percent, seconds);
+ bv.bv_level, percent, seconds, cache);
break;
}
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index e2e5dfe7670..4c4bcc4b402 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.42 2012/01/20 12:38:19 jsing Exp $ */
+/* $OpenBSD: biovar.h,v 1.43 2013/10/23 13:05:38 kettenis Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -139,6 +139,13 @@ struct bioc_vol {
u_quad_t bv_size; /* size of the disk */
int bv_level; /* raid level */
int bv_nodisk; /* nr of drives */
+ int bv_cache; /* cache mode */
+#define BIOC_CVUNKNOWN 0x00
+#define BIOC_CVUNKNOWN_S ""
+#define BIOC_CVWRITEBACK 0x01
+#define BIOC_CVWRITEBACK_S "WB"
+#define BIOC_CVWRITETHROUGH 0x02
+#define BIOC_CVWRITETHROUGH_S "WT"
char bv_dev[16]; /* device */
char bv_vendor[32]; /* scsi string */
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index b62130a3aef..80914423956 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.147 2013/10/09 09:40:01 jmatthew Exp $ */
+/* $OpenBSD: mfi.c,v 1.148 2013/10/23 13:05:38 kettenis Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -1629,6 +1629,11 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
break;
}
+ if (sc->sc_ld_details[i].mld_cfg.mlc_prop.mlp_cur_cache_policy & 0x01)
+ bv->bv_cache = BIOC_CVWRITEBACK;
+ else
+ bv->bv_cache = BIOC_CVWRITETHROUGH;
+
/*
* The RAID levels are determined per the SNIA DDF spec, this is only
* a subset that is valid for the MFI controller.