Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe add support for DIOCGCACHE; contrary to DI...
details: https://anonhg.NetBSD.org/src/rev/a2d81daee008
branches: trunk
changeset: 352501:a2d81daee008
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Wed Apr 05 19:40:26 2017 +0000
description:
add support for DIOCGCACHE; contrary to DIOCCACHESYNC, query any non-dead
disk in the set, even currently reconstring one
diffstat:
sys/dev/raidframe/rf_netbsdkintf.c | 53 ++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 2 deletions(-)
diffs (88 lines):
diff -r 4983d9cc8d91 -r a2d81daee008 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Wed Apr 05 18:34:56 2017 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Wed Apr 05 19:40:26 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.347 2016/09/19 23:37:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.348 2017/04/05 19:40:26 jdolecek Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -188,6 +188,7 @@
struct raid_softc;
static void raidinit(struct raid_softc *);
static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp);
+static int rf_get_component_caches(RF_Raid_t *raidPtr, int *);
static int raid_match(device_t, cfdata_t, void *);
static void raid_attach(device_t, device_t, void *);
@@ -1787,6 +1788,10 @@
*/
switch (cmd) {
+ case DIOCGCACHE:
+ retcode = rf_get_component_caches(raidPtr, (int *)data);
+ break;
+
case DIOCCACHESYNC:
retcode = rf_sync_component_caches(raidPtr);
break;
@@ -3679,6 +3684,50 @@
disk_set_info(dksc->sc_dev, &dksc->sc_dkdev, NULL);
}
+/*
+ * Get cache info for all the components (including spares).
+ * Returns intersection of all the cache flags of all disks, or first
+ * error if any encountered.
+ * XXXfua feature flags can change as spares are added - lock down somehow
+ */
+static int
+rf_get_component_caches(RF_Raid_t *raidPtr, int *data)
+{
+ int c;
+ int error;
+ int dkwhole = 0, dkpart;
+
+ for (c = 0; c < raidPtr->numCol + raidPtr->numSpare; c++) {
+ /*
+ * Check any non-dead disk, even when currently being
+ * reconstructed.
+ */
+ if (!RF_DEAD_DISK(raidPtr->Disks[c].status)
+ || raidPtr->Disks[c].status == rf_ds_reconstructing) {
+ error = VOP_IOCTL(raidPtr->raid_cinfo[c].ci_vp,
+ DIOCGCACHE, &dkpart, FREAD, NOCRED);
+ if (error) {
+ if (error != ENODEV) {
+ printf("raid%d: get cache for component %s failed\n",
+ raidPtr->raidid,
+ raidPtr->Disks[c].devname);
+ }
+
+ return error;
+ }
+
+ if (c == 0)
+ dkwhole = dkpart;
+ else
+ dkwhole = DKCACHE_COMBINE(dkwhole, dkpart);
+ }
+ }
+
+ *data = (dkwhole >= 0) ? dkwhole : 0;
+
+ return 0;
+}
+
/*
* Implement forwarding of the DIOCCACHESYNC ioctl to each of the components.
* We end up returning whatever error was returned by the first cache flush
Home |
Main Index |
Thread Index |
Old Index