Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/genfs Don't modify the local variable `n' in genf...



details:   https://anonhg.NetBSD.org/src/rev/48d0dffa1cae
branches:  trunk
changeset: 526770:48d0dffa1cae
user:      enami <enami%NetBSD.org@localhost>
date:      Fri May 10 02:51:44 2002 +0000

description:
Don't modify the local variable `n' in genfs_putpages().  It should contain
the number of elements in the page array at the beginning of every iteration.

diffstat:

 sys/miscfs/genfs/genfs_vnops.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (57 lines):

diff -r 562b4099e8d3 -r 48d0dffa1cae sys/miscfs/genfs/genfs_vnops.c
--- a/sys/miscfs/genfs/genfs_vnops.c    Fri May 10 02:33:17 2002 +0000
+++ b/sys/miscfs/genfs/genfs_vnops.c    Fri May 10 02:51:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_vnops.c,v 1.59 2002/05/09 07:22:09 enami Exp $   */
+/*     $NetBSD: genfs_vnops.c,v 1.60 2002/05/10 02:51:44 enami Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.59 2002/05/09 07:22:09 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.60 2002/05/10 02:51:44 enami Exp $");
 
 #include "opt_nfsserver.h"
 
@@ -991,10 +991,10 @@
        off_t endoff = ap->a_offhi;
        off_t off;
        int flags = ap->a_flags;
-       int n = MAXBSIZE >> PAGE_SHIFT;
+       const int maxpages = MAXBSIZE >> PAGE_SHIFT;
        int i, s, error, npages, nback;
        int freeflag;
-       struct vm_page *pgs[n], *pg, *nextpg, *tpg, curmp, endmp;
+       struct vm_page *pgs[maxpages], *pg, *nextpg, *tpg, curmp, endmp;
        boolean_t wasclean, by_list, needs_clean, yield;
        boolean_t async = (flags & PGO_SYNCIO) == 0;
        boolean_t pagedaemon = curproc == uvm.pagedaemon_proc;
@@ -1150,7 +1150,7 @@
                         * first look backward.
                         */
 
-                       npages = MIN(n >> 1, off >> PAGE_SHIFT);
+                       npages = MIN(maxpages >> 1, off >> PAGE_SHIFT);
                        nback = npages;
                        uvn_findpages(uobj, off - PAGE_SIZE, &nback, &pgs[0],
                            UFP_NOWAIT|UFP_NOALLOC|UFP_DIRTYONLY|UFP_BACKWARD);
@@ -1163,7 +1163,6 @@
                                else
                                        memset(&pgs[npages - nback], 0,
                                            nback * sizeof(pgs[0]));
-                               n -= nback;
                        }
 
                        /*
@@ -1177,7 +1176,7 @@
                         * the array of pages.
                         */
 
-                       npages = n - 1;
+                       npages = maxpages - nback - 1;
                        uvn_findpages(uobj, off + PAGE_SIZE, &npages,
                            &pgs[nback + 1],
                            UFP_NOWAIT|UFP_NOALLOC|UFP_DIRTYONLY);



Home | Main Index | Thread Index | Old Index