Module Name: src
Committed By: riastradh
Date: Sat Apr 1 19:57:54 UTC 2017
Modified Files:
src/sys/miscfs/genfs: genfs_io.c
Log Message:
Simplify genfs_getpages_read async/unlock protocol.
Previously the caller unlocked for error or sync I/O, whereas
genfs_getpages_read unlocked on successful async.
Now caller unlocks in every case, and genfs_getpages_read doesn't
touch the lock.
To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/miscfs/genfs/genfs_io.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.66 src/sys/miscfs/genfs/genfs_io.c:1.67
--- src/sys/miscfs/genfs/genfs_io.c:1.66 Thu Mar 30 09:12:21 2017
+++ src/sys/miscfs/genfs/genfs_io.c Sat Apr 1 19:57:54 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.66 2017/03/30 09:12:21 hannken Exp $ */
+/* $NetBSD: genfs_io.c,v 1.67 2017/04/01 19:57:54 riastradh Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.66 2017/03/30 09:12:21 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.67 2017/04/01 19:57:54 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -428,11 +428,11 @@ startover:
mutex_exit(uobj->vmobjlock);
error = genfs_getpages_read(vp, pgs, npages, startoffset, diskeof,
async, memwrite, blockalloc, glocked);
- if (error == 0 && async)
- goto out_err_free;
if (!glocked) {
genfs_node_unlock(vp);
}
+ if (error == 0 && async)
+ goto out_err_free;
mutex_enter(uobj->vmobjlock);
/*
@@ -714,9 +714,6 @@ loopdone:
nestiobuf_done(mbp, skipbytes, error);
if (async) {
UVMHIST_LOG(ubchist, "returning 0 (async)",0,0,0,0);
- if (!glocked) {
- genfs_node_unlock(vp);
- }
return 0;
}
if (bp != NULL) {