Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys use shared locks instead of exclusive for VOP_READ() and...
details: https://anonhg.NetBSD.org/src/rev/ea876fdaab17
branches: trunk
changeset: 515272:ea876fdaab17
user: chs <chs%NetBSD.org@localhost>
date: Fri Sep 21 08:02:55 2001 +0000
description:
use shared locks instead of exclusive for VOP_READ() and VOP_READDIR().
diffstat:
sys/kern/vfs_vnops.c | 15 ++++++++++-----
sys/miscfs/specfs/spec_vnops.c | 4 ++--
2 files changed, 12 insertions(+), 7 deletions(-)
diffs (61 lines):
diff -r 57a81937202a -r ea876fdaab17 sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c Fri Sep 21 07:57:35 2001 +0000
+++ b/sys/kern/vfs_vnops.c Fri Sep 21 08:02:55 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnops.c,v 1.49 2001/09/15 20:36:37 chs Exp $ */
+/* $NetBSD: vfs_vnops.c,v 1.50 2001/09/21 08:02:55 chs Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -248,8 +248,13 @@
struct iovec aiov;
int error;
- if ((ioflg & IO_NODELOCKED) == 0)
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ if ((ioflg & IO_NODELOCKED) == 0) {
+ if (rw == UIO_READ) {
+ vn_lock(vp, LK_SHARED | LK_RETRY);
+ } else {
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ }
+ }
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
aiov.iov_base = base;
@@ -299,7 +304,7 @@
auio.uio_segflg = segflg;
auio.uio_procp = p;
auio.uio_resid = count;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ vn_lock(vp, LK_SHARED | LK_RETRY);
auio.uio_offset = fp->f_offset;
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, cookies,
ncookies);
@@ -384,7 +389,7 @@
ioflag |= IO_SYNC;
if (fp->f_flag & FALTIO)
ioflag |= IO_ALTSEMANTICS;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ vn_lock(vp, LK_SHARED | LK_RETRY);
uio->uio_offset = *offset;
count = uio->uio_resid;
error = VOP_READ(vp, uio, ioflag, cred);
diff -r 57a81937202a -r ea876fdaab17 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Fri Sep 21 07:57:35 2001 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Fri Sep 21 08:02:55 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.57 2001/09/15 20:36:38 chs Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.58 2001/09/21 08:02:55 chs Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -284,7 +284,7 @@
VOP_UNLOCK(vp, 0);
error = (*cdevsw[major(vp->v_rdev)].d_read)
(vp->v_rdev, uio, ap->a_ioflag);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+ vn_lock(vp, LK_SHARED | LK_RETRY);
return (error);
case VBLK:
Home |
Main Index |
Thread Index |
Old Index