Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe For RAID sets which have no parity (i.e., ...
details: https://anonhg.NetBSD.org/src/rev/0c6a34e8ce49
branches: trunk
changeset: 753018:0c6a34e8ce49
user: jld <jld%NetBSD.org@localhost>
date: Sun Mar 14 21:11:41 2010 +0000
description:
For RAID sets which have no parity (i.e., RAID level 0) and therefore can
never have a parity map, make the parity map ioctls fail with EINVAL.
This makes `raidctl -m` print a scary-looking error on such sets, which
is an improvement over the previous behavior of falsely claiming that
the parity map would be enabled on the next configuration.
diffstat:
sys/dev/raidframe/rf_netbsdkintf.c | 12 ++++++++++--
sys/dev/raidframe/rf_paritymap.c | 18 +++++++++++++++---
sys/dev/raidframe/rf_paritymap.h | 3 ++-
3 files changed, 27 insertions(+), 6 deletions(-)
diffs (112 lines):
diff -r f213802f836d -r 0c6a34e8ce49 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Sun Mar 14 20:19:06 2010 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Sun Mar 14 21:11:41 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.273 2010/03/14 21:11:41 jld Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -139,7 +139,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.272 2010/03/01 14:51:58 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.273 2010/03/14 21:11:41 jld Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1506,11 +1506,15 @@
return (0);
case RAIDFRAME_PARITYMAP_STATUS:
+ if (rf_paritymap_ineligible(raidPtr))
+ return EINVAL;
rf_paritymap_status(raidPtr->parity_map,
(struct rf_pmstat *)data);
return 0;
case RAIDFRAME_PARITYMAP_SET_PARAMS:
+ if (rf_paritymap_ineligible(raidPtr))
+ return EINVAL;
if (raidPtr->parity_map == NULL)
return ENOENT; /* ??? */
if (0 != rf_paritymap_set_params(raidPtr->parity_map,
@@ -1519,10 +1523,14 @@
return 0;
case RAIDFRAME_PARITYMAP_GET_DISABLE:
+ if (rf_paritymap_ineligible(raidPtr))
+ return EINVAL;
*(int *) data = rf_paritymap_get_disable(raidPtr);
return 0;
case RAIDFRAME_PARITYMAP_SET_DISABLE:
+ if (rf_paritymap_ineligible(raidPtr))
+ return EINVAL;
rf_paritymap_set_disable(raidPtr, *(int *)data);
/* XXX should errors be passed up? */
return 0;
diff -r f213802f836d -r 0c6a34e8ce49 sys/dev/raidframe/rf_paritymap.c
--- a/sys/dev/raidframe/rf_paritymap.c Sun Mar 14 20:19:06 2010 +0000
+++ b/sys/dev/raidframe/rf_paritymap.c Sun Mar 14 21:11:41 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritymap.c,v 1.4 2010/03/03 14:23:27 oster Exp $ */
+/* $NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $ */
/*-
* Copyright (c) 2009 Jed Davis.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.4 2010/03/03 14:23:27 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $");
#include <sys/param.h>
#include <sys/callout.h>
@@ -590,6 +590,18 @@
}
/*
+ * Is this RAID set ineligible for parity-map use due to not actually
+ * having any parity? (If so, rf_paritymap_attach is a no-op, but
+ * rf_paritymap_{get,set}_disable will still pointlessly act on the
+ * component labels.)
+ */
+int
+rf_paritymap_ineligible(RF_Raid_t *raidPtr)
+{
+ return raidPtr->Layout.map->faultsTolerated == 0;
+}
+
+/*
* Attach a parity map to a RAID set if appropriate. Includes
* configure-time processing of parity-map fields of component label.
*/
@@ -604,7 +616,7 @@
u_int flags, regions;
struct rf_pmparams params;
- if (raidPtr->Layout.map->faultsTolerated == 0) {
+ if (rf_paritymap_ineligible(raidPtr)) {
/* There isn't any parity. */
return;
}
diff -r f213802f836d -r 0c6a34e8ce49 sys/dev/raidframe/rf_paritymap.h
--- a/sys/dev/raidframe/rf_paritymap.h Sun Mar 14 20:19:06 2010 +0000
+++ b/sys/dev/raidframe/rf_paritymap.h Sun Mar 14 21:11:41 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_paritymap.h,v 1.1 2009/11/17 18:54:26 jld Exp $ */
+/* $NetBSD: rf_paritymap.h,v 1.2 2010/03/14 21:11:41 jld Exp $ */
/*-
* Copyright (c) 2009 Jed Davis.
@@ -112,6 +112,7 @@
int rf_paritymap_merge(struct rf_paritymap_ondisk *,
struct rf_paritymap_ondisk *);
+int rf_paritymap_ineligible(RF_Raid_t *);
void rf_paritymap_attach(RF_Raid_t *, int);
void rf_paritymap_detach(RF_Raid_t *); /* Not while the RAID is live! */
Home |
Main Index |
Thread Index |
Old Index