Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/tls-maxphys]: src/sys/ufs/ufs In the FFS writebehind code (ufs_readwrite...
details: https://anonhg.NetBSD.org/src/rev/f7d71f411b4a
branches: tls-maxphys
changeset: 852931:f7d71f411b4a
user: tls <tls%NetBSD.org@localhost>
date: Sun Oct 14 14:33:32 2012 +0000
description:
In the FFS writebehind code (ufs_readwrite.c:WRITE()), use division
and multiplication instead of shifts, to accomodate devices with
MAXPHYS that is a multiple of the page size, but not a power of 2.
MegaRAID neatly writes out 192k chunks now.
An open question: is is really a good idea to always writebehind
at the largest size supported by the device? Likely not, as this
could have a major impact on I/O fairness. OS X and Solaris both
seem to limit transfers to 128k likely for this reason (the same
problem exists with the readahead code but since it is adaptive,
it will not *always* do huge transfers).
However, simply imposing a smallish limit like 128k here seems
like a bad idea because then we cannot accomodate greedy devices
like RAID, for which you want something like 128k * number of
data components. Hmmmmmm.
diffstat:
sys/ufs/ufs/ufs_readwrite.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diffs (48 lines):
diff -r 934e2a0fe686 -r f7d71f411b4a sys/ufs/ufs/ufs_readwrite.c
--- a/sys/ufs/ufs/ufs_readwrite.c Thu Oct 11 17:09:56 2012 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c Sun Oct 14 14:33:32 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $ */
+/* $NetBSD: ufs_readwrite.c,v 1.104.2.1 2012/10/14 14:33:32 tls Exp $ */
/*-
* Copyright (c) 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.104 2012/04/29 22:54:01 chs Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.104.2.1 2012/10/14 14:33:32 tls Exp $");
#ifdef LFS_READWRITE
#define FS struct lfs
@@ -414,13 +414,22 @@
*/
#ifndef LFS_READWRITE
- if (!async && oldoff >> 16 != uio->uio_offset >> 16) {
- mutex_enter(vp->v_interlock);
- error = VOP_PUTPAGES(vp, (oldoff >> 16) << 16,
- (uio->uio_offset >> 16) << 16,
- PGO_CLEANIT | PGO_JOURNALLOCKED | PGO_LAZY);
- if (error)
- break;
+ {
+ int maximum = vp->v_mount->mnt_maxphys;
+ off_t oldchunk, newchunk;
+
+ oldchunk = (oldoff / maximum) * maximum;
+ newchunk = (uio->uio_offset / maximum) * maximum;
+
+ if (!async && oldchunk != newchunk) {
+ mutex_enter(vp->v_interlock);
+ error = VOP_PUTPAGES(vp, oldchunk, newchunk,
+ PGO_CLEANIT |
+ PGO_JOURNALLOCKED |
+ PGO_LAZY);
+ if (error)
+ break;
+ }
}
#endif
}
Home |
Main Index |
Thread Index |
Old Index