Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm Fetch the right page from a file even if it is mappe...



details:   https://anonhg.NetBSD.org/src/rev/152fc45470e2
branches:  trunk
changeset: 526616:152fc45470e2
user:      enami <enami%NetBSD.org@localhost>
date:      Tue May 07 02:29:52 2002 +0000

description:
Fetch the right page from a file even if it is mapped from middle of it.
This makes `tail -<N> <FILE> | cat > file' correctly, where <FILE> is
a regular file larger than 10Mbytes (makes tail to map part of file)
and <N> is big enough to produce output larger than 8kbytes (makes pipe
to use page loan facility).  Problem reported by FUKAUMI Naoki on japanese
local mailing list.

diffstat:

 sys/uvm/uvm_loan.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r e8af46e3c22e -r 152fc45470e2 sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Tue May 07 02:13:51 2002 +0000
+++ b/sys/uvm/uvm_loan.c        Tue May 07 02:29:52 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.c,v 1.36 2001/12/31 19:21:36 chs Exp $        */
+/*     $NetBSD: uvm_loan.c,v 1.37 2002/05/07 02:29:52 enami Exp $      */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.36 2001/12/31 19:21:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_loan.c,v 1.37 2002/05/07 02:29:52 enami Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -452,7 +452,8 @@
        if (uobj->pgops->pgo_get) {     /* try locked pgo_get */
                npages = 1;
                pg = NULL;
-               error = uobj->pgops->pgo_get(uobj, va - ufi->entry->start,
+               error = (*uobj->pgops->pgo_get)(uobj,
+                   va - ufi->entry->start + ufi->entry->offset,
                    &pg, &npages, 0, VM_PROT_READ, MADV_NORMAL, PGO_LOCKED);
        } else {
                error = EIO;            /* must have pgo_get op */
@@ -477,7 +478,8 @@
 
                /* locked: uobj */
                npages = 1;
-               error = uobj->pgops->pgo_get(uobj, va - ufi->entry->start,
+               error = (*uobj->pgops->pgo_get)(uobj,
+                   va - ufi->entry->start + ufi->entry->offset,
                    &pg, &npages, 0, VM_PROT_READ, MADV_NORMAL, PGO_SYNCIO);
                /* locked: <nothing> */
 



Home | Main Index | Thread Index | Old Index