Module Name: src
Committed By: pooka
Date: Thu Mar 26 08:22:22 UTC 2009
Modified Files:
src/sys/rump/librump/rumpvfs: genfs_io.c
Log Message:
Handle eof a bit differently. E.g. ffs and msdosfs seem to have
a quite different opinion about what happens in bmap beyond EOF,
so avoid calling it.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/librump/rumpvfs/genfs_io.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/rump/librump/rumpvfs/genfs_io.c
diff -u src/sys/rump/librump/rumpvfs/genfs_io.c:1.9 src/sys/rump/librump/rumpvfs/genfs_io.c:1.10
--- src/sys/rump/librump/rumpvfs/genfs_io.c:1.9 Mon Mar 23 11:48:33 2009
+++ src/sys/rump/librump/rumpvfs/genfs_io.c Thu Mar 26 08:22:22 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.9 2009/03/23 11:48:33 pooka Exp $ */
+/* $NetBSD: genfs_io.c,v 1.10 2009/03/26 08:22:22 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.9 2009/03/23 11:48:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.10 2009/03/26 08:22:22 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -376,7 +376,7 @@
mbp = getiobuf(vp, true);
mbp->b_bufsize = MAXPHYS;
mbp->b_data = datap;
- mbp->b_resid = mbp->b_bcount = curoff-smallest;
+ mbp->b_resid = mbp->b_bcount = MIN(curoff,eof)-smallest;
mbp->b_cflags |= BC_BUSY;
mbp->b_flags = B_WRITE;
if (async) {
@@ -388,7 +388,7 @@
mutex_exit(&vp->v_interlock);
/* then we write */
- for (bufoff = 0; bufoff < curoff-smallest; bufoff+=xfersize) {
+ for (bufoff = 0; bufoff < MIN(curoff,eof)-smallest; bufoff+=xfersize) {
struct vnode *devvp;
daddr_t bn, lbn;
size_t iotodo;
@@ -419,12 +419,6 @@
iotodo -= (smallest+bufoff+xfersize) - eof;
iotodo = (iotodo + DEV_BSIZE-1) & ~(DEV_BSIZE-1);
- /*
- * Compensate for potentially smaller write. This will
- * be zero except near eof.
- */
- skipbytes += xfersize - iotodo;
-
KASSERT(iotodo > 0);
KASSERT(smallest >= 0);