summaryrefslogtreecommitdiffstats
path: root/sys/sys/bufobj.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-21 14:42:31 +0000
committerphk <phk@FreeBSD.org>2004-10-21 14:42:31 +0000
commitfdf614c0bad1564664cac5105be08477d1bcdd72 (patch)
tree35b8f04f813e4a9a9475de9f0d5648647e1adefb /sys/sys/bufobj.h
parentb436dad078f20cb7f18ead7553923d45b0d6fcdf (diff)
downloadFreeBSD-src-fdf614c0bad1564664cac5105be08477d1bcdd72.zip
FreeBSD-src-fdf614c0bad1564664cac5105be08477d1bcdd72.tar.gz
Add BO_* macros parallel to VI_* macros for manipulating the bo_mtx.
Initialize the bo_mtx when we allocate a vnode i getnewvnode() For now we point to the vnodes interlock mutex, that retains the exact same locking sematics. Move v_numoutput from vnode to bufobj. Add renaming macro to postpone code sweep.
Diffstat (limited to 'sys/sys/bufobj.h')
-rw-r--r--sys/sys/bufobj.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/sys/bufobj.h b/sys/sys/bufobj.h
index b930176..62ac91f 100644
--- a/sys/sys/bufobj.h
+++ b/sys/sys/bufobj.h
@@ -66,8 +66,25 @@ struct bufobj {
struct mtx *bo_mtx; /* Mutex which protects "i" things */
struct bufv bo_clean; /* i Clean buffers */
struct bufv bo_dirty; /* i Dirty buffers */
+ long bo_numoutput; /* i Writes in progress */
};
+#define BO_LOCK(bo) \
+ do { \
+ KASSERT (bo->bo_mtx != NULL, ("No lock in bufobj")); \
+ mtx_lock((bo)->bo_mtx); \
+ } while (0)
+
+#define BO_UNLOCK(bo) \
+ do { \
+ KASSERT (bo->bo_mtx != NULL, ("No lock in bufobj")); \
+ mtx_unlock((bo)->bo_mtx); \
+ } while (0)
+
+#define BO_MTX(bo) ((bo)->bo_mtx)
+#define ASSERT_BO_LOCKED(bo) mtx_assert(bo->bo_mtx, MA_OWNED)
+#define ASSERT_BO_UNLOCKED(bo) mtx_assert(bo->bo_mtx, MA_NOTOWNED)
+
#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */
#endif /* _SYS_BUFOBJ_H_ */
OpenPOWER on IntegriCloud