Module Name: src
Committed By: tls
Date: Wed Oct 17 01:36:13 UTC 2012
Modified Files:
src/sys/dev/raidframe [tls-maxphys]: rf_netbsdkintf.c
Log Message:
Add a minphys routine for raidframe.
For now, we will address the problem of someone adding, at runtime with
a filesystem mounted, a drive to an existing RAID set, that drive being
on a different controller or bus such that it has a smaller maximum
transfer size than the smallest such size of any component previously
in the set, by clamping RAIDframe's reported maximum transfer size at
the old MAXPHYS value multiplied by the number of data disks in the
set.
In the future, we could either implement transfer-splitting to
the device specific maxphys in a generic way for all disks (Manuel's
proposal, and probably the best solution) or simply forbid adding
new components to RAID sets while running if those new components
have a smaller maxphys than that of any component already in the set
(my proposal; less flexible but a lot less code to write).
Anyway, now you should be able to see your 5 disk RAID5 set do
256k transfers through the filesystem -- 64k per component
instead of 64K total. A win!
To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.298.2.1 src/sys/dev/raidframe/rf_netbsdkintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.298 src/sys/dev/raidframe/rf_netbsdkintf.c:1.298.2.1
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.298 Thu Aug 9 23:53:25 2012
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Wed Oct 17 01:36:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.298 2012/08/09 23:53:25 buhrow Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.298.2.1 2012/10/17 01:36:13 tls 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.298 2012/08/09 23:53:25 buhrow Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.298.2.1 2012/10/17 01:36:13 tls Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -216,7 +216,9 @@ const struct cdevsw raid_cdevsw = {
nostop, notty, nopoll, nommap, nokqfilter, D_DISK
};
-static struct dkdriver rf_dkdriver = { raidstrategy, minphys };
+static void raidminphys(struct buf *);
+
+static struct dkdriver rf_dkdriver = { raidstrategy, raidminphys };
/* XXX Not sure if the following should be replacing the raidPtrs above,
or if it should be used in conjunction with that...
@@ -925,7 +927,7 @@ raidread(dev_t dev, struct uio *uio, int
if ((rs->sc_flags & RAIDF_INITED) == 0)
return (ENXIO);
- return (physio(raidstrategy, NULL, dev, B_READ, minphys, uio));
+ return (physio(raidstrategy, NULL, dev, B_READ, raidminphys, uio));
}
/* ARGSUSED */
@@ -942,7 +944,7 @@ raidwrite(dev_t dev, struct uio *uio, in
if ((rs->sc_flags & RAIDF_INITED) == 0)
return (ENXIO);
- return (physio(raidstrategy, NULL, dev, B_WRITE, minphys, uio));
+ return (physio(raidstrategy, NULL, dev, B_WRITE, raidminphys, uio));
}
@@ -3963,3 +3965,24 @@ rf_sync_component_caches(RF_Raid_t *raid
}
return error;
}
+
+static void
+raidminphys(struct buf *bp)
+{
+ dev_t dev;
+ int unit;
+ struct raid_softc *rs;
+ RF_Raid_t *raidPtr;
+ long xmax;
+
+ dev = bp->b_dev;
+ unit = raidunit(dev);
+ rs = &raid_softc[unit];
+ raidPtr = raidPtrs[unit];
+
+ xmax = raidPtr->Layout.numDataCol * MAXPHYS;
+
+ if (bp->b_bcount > xmax) {
+ bp->b_bcount = xmax;
+ }
+}