Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys - shuffle members of struct buf to distinguish buffe...
details: https://anonhg.NetBSD.org/src/rev/b6b71ca6387d
branches: trunk
changeset: 555920:b6b71ca6387d
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Dec 04 15:00:32 2003 +0000
description:
- shuffle members of struct buf to distinguish buffer cache only ones.
- put b_private and b_dcookie into a union as they're never used
simultaneously.
- note who can use b_private.
diffstat:
sys/sys/buf.h | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
diffs (66 lines):
diff -r fcd8bfb13e4a -r b6b71ca6387d sys/sys/buf.h
--- a/sys/sys/buf.h Thu Dec 04 14:57:47 2003 +0000
+++ b/sys/sys/buf.h Thu Dec 04 15:00:32 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.64 2003/08/07 16:33:59 agc Exp $ */
+/* $NetBSD: buf.h,v 1.65 2003/12/04 15:00:32 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -149,13 +149,9 @@
* The buffer header describes an I/O operation in the kernel.
*/
struct buf {
- LIST_ENTRY(buf) b_hash; /* Hash chain. */
- LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
- TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
TAILQ_ENTRY(buf) b_actq; /* Device driver queue when active. */
- struct proc *b_proc; /* Associated proc if B_PHYS set. */
+ struct simplelock b_interlock; /* Lock for b_flags changes */
volatile long b_flags; /* B_* flags. */
- struct simplelock b_interlock; /* Lock for b_flags changes */
int b_error; /* Errno value. */
long b_bufsize; /* Allocated buffer size. */
long b_bcount; /* Valid bytes in buffer. */
@@ -164,18 +160,37 @@
struct {
caddr_t b_addr; /* Memory, superblocks, indirect etc. */
} b_un;
- void *b_saveaddr; /* Original b_addr for physio. */
- daddr_t b_lblkno; /* Logical block number. */
daddr_t b_blkno; /* Underlying physical block number
(partition relative) */
daddr_t b_rawblkno; /* Raw underlying physical block
number (not partition relative) */
/* Function to call upon completion. */
void (*b_iodone) __P((struct buf *));
+ struct proc *b_proc; /* Associated proc if B_PHYS set. */
struct vnode *b_vp; /* File vnode. */
- void *b_private; /* Private data for owner */
- off_t b_dcookie; /* Offset cookie if dir block */
struct workhead b_dep; /* List of filesystem dependencies. */
+ void *b_saveaddr; /* Original b_addr for physio. */
+
+ /*
+ * private data for owner.
+ * - buffer cache buffers are owned by corresponding filesystem.
+ * - non-buffer cache buffers are owned by subsystem which
+ * allocated them. (filesystem, disk driver, etc)
+ */
+ union {
+ void *bf_private;
+ off_t bf_dcookie; /* NFS: Offset cookie if dir block */
+ } b_fspriv;
+#define b_private b_fspriv.bf_private
+#define b_dcookie b_fspriv.bf_dcookie
+
+ /*
+ * buffer cache specific data
+ */
+ LIST_ENTRY(buf) b_hash; /* Hash chain. */
+ LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
+ TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
+ daddr_t b_lblkno; /* Logical block number. */
};
#define BUF_INIT(bp) \
Home |
Main Index |
Thread Index |
Old Index