Source-Changes-HG archive

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

[src/trunk]: src/sys allow tmpfs files to be larger than 4GB.



details:   https://anonhg.NetBSD.org/src/rev/ccd490be2889
branches:  trunk
changeset: 319397:ccd490be2889
user:      chs <chs%NetBSD.org@localhost>
date:      Mon May 28 21:04:35 2018 +0000

description:
allow tmpfs files to be larger than 4GB.

diffstat:

 sys/fs/tmpfs/tmpfs_subr.c |   6 +++---
 sys/uvm/uvm_aobj.c        |  16 +++++++++-------
 sys/uvm/uvm_extern.h      |   5 +++--
 3 files changed, 15 insertions(+), 12 deletions(-)

diffs (96 lines):

diff -r c40affc7fd3a -r ccd490be2889 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Mon May 28 20:52:50 2018 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Mon May 28 21:04:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $ */
+/*     $NetBSD: tmpfs_subr.c,v 1.103 2018/05/28 21:04:35 chs Exp $     */
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.103 2018/05/28 21:04:35 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/cprng.h>
@@ -275,7 +275,7 @@
        case VREG:
                /* Regular file.  Create an underlying UVM object. */
                node->tn_spec.tn_reg.tn_aobj =
-                   uao_create(INT32_MAX - PAGE_SIZE, 0);
+                   uao_create(INT64_MAX - PAGE_SIZE, 0);
                node->tn_spec.tn_reg.tn_aobj_pages = 0;
                break;
        default:
diff -r c40affc7fd3a -r ccd490be2889 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Mon May 28 20:52:50 2018 +0000
+++ b/sys/uvm/uvm_aobj.c        Mon May 28 21:04:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.126 2017/10/28 00:37:13 pgoyette Exp $  */
+/*     $NetBSD: uvm_aobj.c,v 1.127 2018/05/28 21:04:35 chs Exp $       */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.126 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.127 2018/05/28 21:04:35 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -408,12 +408,12 @@
  */
 
 struct uvm_object *
-uao_create(vsize_t size, int flags)
+uao_create(voff_t size, int flags)
 {
        static struct uvm_aobj kernel_object_store;
        static kmutex_t kernel_object_lock;
        static int kobj_alloced __diagused = 0;
-       pgoff_t pages = round_page(size) >> PAGE_SHIFT;
+       pgoff_t pages = round_page((uint64_t)size) >> PAGE_SHIFT;
        struct uvm_aobj *aobj;
        int refs;
 
@@ -700,9 +700,11 @@
                } else {
                        stop = round_page(stop);
                }
-               if (stop > (aobj->u_pages << PAGE_SHIFT)) {
-                       printf("uao_flush: strange, got an out of range "
-                           "flush (fixed)\n");
+               if (stop > (uint64_t)(aobj->u_pages << PAGE_SHIFT)) {
+                       printf("uao_put: strange, got an out of range "
+                           "flush 0x%jx > 0x%jx (fixed)\n",
+                           (uintmax_t)stop,
+                           (uintmax_t)(aobj->u_pages << PAGE_SHIFT));
                        stop = aobj->u_pages << PAGE_SHIFT;
                }
                by_list = (uobj->uo_npages <=
diff -r c40affc7fd3a -r ccd490be2889 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Mon May 28 20:52:50 2018 +0000
+++ b/sys/uvm/uvm_extern.h      Mon May 28 21:04:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.212 2018/05/19 11:39:37 jdolecek Exp $        */
+/*     $NetBSD: uvm_extern.h,v 1.213 2018/05/28 21:04:35 chs Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -603,9 +603,10 @@
 /* vm_machdep.c */
 int            vmapbuf(struct buf *, vsize_t);
 void           vunmapbuf(struct buf *, vsize_t);
+void           ktext_write(void *, const void *, size_t);
 
 /* uvm_aobj.c */
-struct uvm_object      *uao_create(vsize_t, int);
+struct uvm_object      *uao_create(voff_t, int);
 void                   uao_set_pgfl(struct uvm_object *, int);
 void                   uao_detach(struct uvm_object *);
 void                   uao_reference(struct uvm_object *);



Home | Main Index | Thread Index | Old Index