Source-Changes-HG archive

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

[src/trunk]: src/sys Allow sparc kernels to build with SSP by using a constan...



details:   https://anonhg.NetBSD.org/src/rev/5cbbf124fa5b
branches:  trunk
changeset: 818147:5cbbf124fa5b
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 29 18:47:35 2016 +0000

description:
Allow sparc kernels to build with SSP by using a constant PAGE_SIZE...

diffstat:

 sys/kern/vfs_bio.c          |  13 ++++++-------
 sys/miscfs/genfs/genfs_io.c |  13 ++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diffs (92 lines):

diff -r 9b45e88b678e -r 5cbbf124fa5b sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Thu Sep 29 17:01:43 2016 +0000
+++ b/sys/kern/vfs_bio.c        Thu Sep 29 18:47:35 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.260 2016/07/31 04:05:32 dholland Exp $   */
+/*     $NetBSD: vfs_bio.c,v 1.261 2016/09/29 18:47:35 christos Exp $   */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.260 2016/07/31 04:05:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.261 2016/09/29 18:47:35 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1882,19 +1882,18 @@
        int i, j, count;
        buf_t *bp;
        struct bqueue *dp;
-       int counts[(MAXBSIZE / PAGE_SIZE) + 1];
+       int counts[MAXBSIZE / MIN_PAGE_SIZE + 1];
        static const char *bname[BQUEUES] = { "LOCKED", "LRU", "AGE" };
 
        for (dp = bufqueues, i = 0; dp < &bufqueues[BQUEUES]; dp++, i++) {
                count = 0;
-               for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++)
-                       counts[j] = 0;
+               memset(counts, 0, sizeof(counts));
                TAILQ_FOREACH(bp, &dp->bq_queue, b_freelist) {
-                       counts[bp->b_bufsize/PAGE_SIZE]++;
+                       counts[bp->b_bufsize / PAGE_SIZE]++;
                        count++;
                }
                printf("%s: total-%d", bname[i], count);
-               for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++)
+               for (j = 0; j <= MAXBSIZE / PAGE_SIZE; j++)
                        if (counts[j] != 0)
                                printf(", %d-%d", j * PAGE_SIZE, counts[j]);
                printf("\n");
diff -r 9b45e88b678e -r 5cbbf124fa5b sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c       Thu Sep 29 17:01:43 2016 +0000
+++ b/sys/miscfs/genfs/genfs_io.c       Thu Sep 29 18:47:35 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: genfs_io.c,v 1.61 2015/05/06 15:57:08 hannken Exp $    */
+/*     $NetBSD: genfs_io.c,v 1.62 2016/09/29 18:47:35 christos Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.61 2015/05/06 15:57:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.62 2016/09/29 18:47:35 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -821,11 +821,10 @@
        struct uvm_object * const uobj = &vp->v_uobj;
        kmutex_t * const slock = uobj->vmobjlock;
        off_t off;
-       /* Even for strange MAXPHYS, the shift rounds down to a page */
-#define maxpages (MAXPHYS >> PAGE_SHIFT)
+#define MAXPAGES (MAXPHYS / MIN_PAGE_SIZE)
        int i, error, npages, nback;
        int freeflag;
-       struct vm_page *pgs[maxpages], *pg, *nextpg, *tpg, curmp, endmp;
+       struct vm_page *pgs[MAXPAGES], *pg, *nextpg, *tpg, curmp, endmp;
        bool wasclean, by_list, needs_clean, yld;
        bool async = (origflags & PGO_SYNCIO) == 0;
        bool pagedaemon = curlwp == uvm.pagedaemon_lwp;
@@ -1084,7 +1083,7 @@
                         * first look backward.
                         */
 
-                       npages = MIN(maxpages >> 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);
@@ -1110,7 +1109,7 @@
                         * the array of pages.
                         */
 
-                       npages = maxpages - nback - 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