Module Name:    src
Committed By:   chs
Date:           Mon May 28 21:04:35 UTC 2018

Modified Files:
        src/sys/fs/tmpfs: tmpfs_subr.c
        src/sys/uvm: uvm_aobj.c uvm_extern.h

Log Message:
allow tmpfs files to be larger than 4GB.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/fs/tmpfs/tmpfs_subr.c
cvs rdiff -u -r1.126 -r1.127 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.212 -r1.213 src/sys/uvm/uvm_extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.102 src/sys/fs/tmpfs/tmpfs_subr.c:1.103
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.102	Wed Jan  4 10:06:43 2017
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Mon May 28 21:04:35 2018
@@ -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 @@ tmpfs_newvnode(struct mount *mp, struct 
 	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:

Index: src/sys/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.126 src/sys/uvm/uvm_aobj.c:1.127
--- src/sys/uvm/uvm_aobj.c:1.126	Sat Oct 28 00:37:13 2017
+++ src/sys/uvm/uvm_aobj.c	Mon May 28 21:04:35 2018
@@ -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 @@ uao_free(struct uvm_aobj *aobj)
  */
 
 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 @@ uao_put(struct uvm_object *uobj, voff_t 
 		} 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 <=

Index: src/sys/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.212 src/sys/uvm/uvm_extern.h:1.213
--- src/sys/uvm/uvm_extern.h:1.212	Sat May 19 11:39:37 2018
+++ src/sys/uvm/uvm_extern.h	Mon May 28 21:04:35 2018
@@ -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 @@ extern struct vm_map *phys_map;
 /* 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 *);

Reply via email to