Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add a small comment on buffer cache locking, fix mark le...
details: https://anonhg.NetBSD.org/src/rev/6b67bb2c98df
branches: trunk
changeset: 748937:6b67bb2c98df
user: rmind <rmind%NetBSD.org@localhost>
date: Wed Nov 11 09:15:42 2009 +0000
description:
Add a small comment on buffer cache locking, fix mark letter b_objlock.
diffstat:
sys/kern/vfs_bio.c | 20 ++++++++++++++++++--
sys/sys/buf.h | 4 ++--
2 files changed, 20 insertions(+), 4 deletions(-)
diffs (59 lines):
diff -r 44da05ceebb0 -r 6b67bb2c98df sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c Wed Nov 11 09:11:26 2009 +0000
+++ b/sys/kern/vfs_bio.c Wed Nov 11 09:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_bio.c,v 1.220 2009/11/11 07:22:33 rmind Exp $ */
+/* $NetBSD: vfs_bio.c,v 1.221 2009/11/11 09:15:42 rmind Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -100,14 +100,30 @@
*/
/*
+ * The buffer cache subsystem.
+ *
* Some references:
* Bach: The Design of the UNIX Operating System (Prentice Hall, 1986)
* Leffler, et al.: The Design and Implementation of the 4.3BSD
* UNIX Operating System (Addison Welley, 1989)
+ *
+ * Locking
+ *
+ * There are three locks:
+ * - bufcache_lock: protects global buffer cache state.
+ * - BC_BUSY: a long term per-buffer lock.
+ * - buf_t::b_objlock: lock on completion (biowait vs biodone).
+ *
+ * For buffers associated with vnodes (a most common case) b_objlock points
+ * to the vnode_t::v_interlock. Otherwise, it points to generic buffer_lock.
+ *
+ * Lock order:
+ * bufcache_lock ->
+ * buf_t::b_objlock
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.220 2009/11/11 07:22:33 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.221 2009/11/11 09:15:42 rmind Exp $");
#include "fs_ffs.h"
#include "opt_bufcache.h"
diff -r 44da05ceebb0 -r 6b67bb2c98df sys/sys/buf.h
--- a/sys/sys/buf.h Wed Nov 11 09:11:26 2009 +0000
+++ b/sys/sys/buf.h Wed Nov 11 09:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.114 2009/11/11 07:22:34 rmind Exp $ */
+/* $NetBSD: buf.h,v 1.115 2009/11/11 09:15:42 rmind Exp $ */
/*-
* Copyright (c) 1999, 2000, 2007, 2008 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
* b thread of execution that holds BC_BUSY, does not correspond
* directly to any particular LWP
* c bufcache_lock
- * l b_objlock
+ * o b_objlock
*
* For buffers associated with a vnode, b_objlock points to vp->v_interlock.
* If not associated with a vnode, it points to the generic buffer_lock.
Home |
Main Index |
Thread Index |
Old Index