Diff below makes bioctl(4) print the cache policy for that's currently
in effect for RAID volumes. It only prints the state (WB for
write-back, WT for write-through) if the RAID controller driver fills
in the details in response to a BIOCVOL ioctl. This diff adds such
support to mfi(4).
# bioctl mfi0
Volume Status Size Device
mfi0 0 Online 72746008576 sd0 RAID1 WB
0 Online 73407820800 1:0.0 noencl <HITACHI HUS153073VLS300
A598>
1 Online 73407820800 1:1.0 noencl <HITACHI HUS153073VLS300
A598>
ok?
Index: sbin/bioctl/bioctl.c
===================================================================
RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
retrieving revision 1.112
diff -u -p -r1.112 bioctl.c
--- sbin/bioctl/bioctl.c 10 Sep 2012 11:28:47 -0000 1.112
+++ sbin/bioctl/bioctl.c 22 Oct 2013 12:47:36 -0000
@@ -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;
}
Index: sys/dev/biovar.h
===================================================================
RCS file: /cvs/src/sys/dev/biovar.h,v
retrieving revision 1.42
diff -u -p -r1.42 biovar.h
--- sys/dev/biovar.h 20 Jan 2012 12:38:19 -0000 1.42
+++ sys/dev/biovar.h 22 Oct 2013 12:47:37 -0000
@@ -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 */
Index: sys/dev/ic/mfi.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/mfi.c,v
retrieving revision 1.147
diff -u -p -r1.147 mfi.c
--- sys/dev/ic/mfi.c 9 Oct 2013 09:40:01 -0000 1.147
+++ sys/dev/ic/mfi.c 22 Oct 2013 12:47:37 -0000
@@ -1629,6 +1629,11 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
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.