Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/genfs when zeroing pages past EOF, don't zero the...
details: https://anonhg.NetBSD.org/src/rev/54c3cb15cf69
branches: trunk
changeset: 515270:54c3cb15cf69
user: chs <chs%NetBSD.org@localhost>
date: Fri Sep 21 07:52:25 2001 +0000
description:
when zeroing pages past EOF, don't zero the page containing EOF if it
already contains valid data. should fix PRs 13361 and 13436.
diffstat:
sys/miscfs/genfs/genfs_vnops.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (32 lines):
diff -r 2f4b6108a300 -r 54c3cb15cf69 sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c Fri Sep 21 07:11:33 2001 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c Fri Sep 21 07:52:25 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_vnops.c,v 1.37 2001/09/15 20:36:38 chs Exp $ */
+/* $NetBSD: genfs_vnops.c,v 1.38 2001/09/21 07:52:25 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -640,12 +640,20 @@
/*
* if EOF is in the middle of the range, zero the part past EOF.
+ * if the page including EOF is not PG_FAKE, skip over it since
+ * in that case it has valid data that we need to preserve.
*/
if (tailbytes > 0) {
+ size_t tailstart = bytes;
+
+ if ((pgs[bytes >> PAGE_SHIFT]->flags & PG_FAKE) == 0) {
+ tailstart = round_page(tailstart);
+ tailbytes -= tailstart - bytes;
+ }
UVMHIST_LOG(ubchist, "tailbytes %p 0x%x 0x%x",
- kva, bytes, tailbytes,0);
- memset((void *)(kva + bytes), 0, tailbytes);
+ kva, tailstart, tailbytes,0);
+ memset((void *)(kva + tailstart), 0, tailbytes);
}
/*
Home |
Main Index |
Thread Index |
Old Index