svn commit: r292893 - projects/sendfile/sys/kern

Gleb Smirnoff glebius at FreeBSD.org
Tue Dec 29 23:24:11 UTC 2015


Author: glebius
Date: Tue Dec 29 23:24:10 2015
New Revision: 292893
URL: https://svnweb.freebsd.org/changeset/base/292893

Log:
  A temporary fixup for the new sendfile + new pager KPI. The new sendfile still
  manages its readahead itself, so it needs to record the boundary between wired
  pages (part of the actual request) and non-wired pages (readahead). In sf_iodone()
  these pages need to be treated differently.

Modified:
  projects/sendfile/sys/kern/uipc_syscalls.c

Modified: projects/sendfile/sys/kern/uipc_syscalls.c
==============================================================================
--- projects/sendfile/sys/kern/uipc_syscalls.c	Tue Dec 29 23:16:20 2015	(r292892)
+++ projects/sendfile/sys/kern/uipc_syscalls.c	Tue Dec 29 23:24:10 2015	(r292893)
@@ -2079,6 +2079,7 @@ struct sf_io {
 	int		npages;
 	struct file	*sock_fp;
 	struct mbuf	*m;
+	vm_pindex_t	last_wired;
 	vm_page_t	pa[];
 };
 
@@ -2088,13 +2089,16 @@ sf_iodone(void *arg, vm_page_t *pg, int 
 	struct sf_io *sfio = arg;
 	struct socket *so;
 
-	if (pg) {
-		for (int i = 0; i < count; i++)
+	for (int i = 0; i < count; i++) {
+		if (pg[i]->pindex <= sfio->last_wired)
 			vm_page_xunbusy(pg[i]);
-		if (error)
-			sfio->error = error;
+		else
+			vm_page_readahead_finish(pg[i]);
 	}
 
+	if (error)
+		sfio->error = error;
+
 	if (!refcount_release(&sfio->nios))
 		return;
 
@@ -2160,6 +2164,9 @@ sendfile_swapin(vm_object_t obj, struct 
 		}
 	}
 
+	if (npages > 0)
+		sfio->last_wired = pa[npages - 1]->pindex;
+
 	for (int i = 0; i < npages;) {
 		int j, a, count, rv;
 


More information about the svn-src-projects mailing list