summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorStefan Fritsch <sf@cvs.openbsd.org>2017-08-22 00:18:57 +0000
committerStefan Fritsch <sf@cvs.openbsd.org>2017-08-22 00:18:57 +0000
commit9f20f2124f4054d44399c302dfdc8b65b0ce971b (patch)
tree2dce1bfd8a7f17d5b7e9bf4c7ed18293146e8752 /share
parent9529fd6d5f19823ec76b6a691d078f11014610a1 (diff)
Add some buffercache docs
* add clarifications and bread_cluster() buffercache(9) * add some comments to vfs_bio.c ok tedu@
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/buffercache.941
1 files changed, 39 insertions, 2 deletions
diff --git a/share/man/man9/buffercache.9 b/share/man/man9/buffercache.9
index 84df0c06513..30c615cd129 100644
--- a/share/man/man9/buffercache.9
+++ b/share/man/man9/buffercache.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: buffercache.9,v 1.11 2017/02/28 19:36:14 natano Exp $
+.\" $OpenBSD: buffercache.9,v 1.12 2017/08/22 00:18:56 sf Exp $
.\" $NetBSD: buffercache.9,v 1.13 2004/06/25 15:31:37 wiz Exp $
.\"
.\" Copyright (c)2003 YAMAMOTO Takashi,
@@ -102,12 +102,13 @@
.\"
.\"
.\" ------------------------------------------------------------
-.Dd $Mdocdate: February 28 2017 $
+.Dd $Mdocdate: August 22 2017 $
.Dt BUFFERCACHE 9
.Os
.Sh NAME
.Nm buffercache ,
.Nm bread ,
+.Nm bread_cluster ,
.Nm breadn ,
.Nm bwrite ,
.Nm bawrite ,
@@ -126,6 +127,9 @@
.Fn bread "struct vnode *vp" "daddr_t blkno" "int size" \
"struct buf **bpp"
.Ft int
+.Fn bread_cluster "struct vnode *vp" "daddr_t blkno" "int size" \
+"struct buf **bpp"
+.Ft int
.Fn breadn "struct vnode *vp" "daddr_t blkno" "int size" \
"daddr_t rablks[]" "int rasizes[]" "int nrablks" \
"struct buf **bpp"
@@ -163,6 +167,11 @@ In addition to describing a cached block, a
.Em buf
structure is also used to describe an I/O request as a part of
the disk driver interface.
+.Pp
+The block size used for logical block numbers depends on the type of the
+given vnode.
+For file vnodes, this is f_iosize of the underlying filesystem.
+For block device vnodes, this will usually be DEV_BSIZE.
.\" XXX struct buf, B_ flags, MP locks, etc.
.\" XXX free list, hash queue, etc.
.\" ------------------------------------------------------------
@@ -184,6 +193,10 @@ to allocate a buffer with enough pages for
.Fa size
and reads the specified disk block into it.
.Pp
+.Fn bread
+always returns a buffer, even if it returns an error due to an I/O
+error.
+.Pp
The buffer returned by
.Fn bread
is marked as busy.
@@ -222,6 +235,30 @@ and
The read-ahead blocks aren't returned, but are available in cache for
future accesses.
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+.It Xo
+.Fo bread_cluster
+.Fa "vp"
+.Fa "blkno"
+.Fa "size"
+.Fa "bpp"
+.Fc
+.Xc
+Read a block of size
+.Fa "size"
+corresponding to
+.Fa vp
+and
+.Fa blkno ,
+with readahead.
+If neither the first block nor a part of the next MAXBSIZE bytes is already
+in the buffer cache,
+.Fn bread_cluster
+will perform a read-ahead of MAXBSIZE bytes in a single I/O operation.
+This is currently more efficient than
+.Fn breadn .
+The read-ahead data isn't returned, but is available in cache for
+future access.
+.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.It Fn bwrite "bp"
Write a block.
Start I/O for write using