FreeBSD kernel kern code
vfs_bio.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bio.h>
#include <sys/conf.h>
#include <sys/buf.h>
#include <sys/devicestat.h>
#include <sys/eventhandler.h>
#include <sys/fail.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sysctl.h>
#include <sys/vmmeter.h>
#include <sys/vnode.h>
#include <geom/geom.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_kern.h>
#include <vm/vm_pageout.h>
#include <vm/vm_page.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include "opt_compat.h"
#include "opt_directio.h"
#include "opt_swap.h"
#include "opt_ddb.h"
Include dependency graph for vfs_bio.c:

Go to the source code of this file.

Macros

#define BUFFER_QUEUES   6 /* number of free buffer queues */
 
#define QUEUE_NONE   0 /* on no queue */
 
#define QUEUE_CLEAN   1 /* non-B_DELWRI buffers */
 
#define QUEUE_DIRTY   2 /* B_DELWRI buffers */
 
#define QUEUE_DIRTY_GIANT   3 /* B_DELWRI buffers that need giant */
 
#define QUEUE_EMPTYKVA   4 /* empty buffer headers w/KVA assignment */
 
#define QUEUE_EMPTY   5 /* empty buffer headers */
 
#define QUEUE_SENTINEL   1024 /* not an queue index, but mark for sentinel */
 
#define VFS_BIO_NEED_ANY   0x01 /* any freeable buffer */
 
#define VFS_BIO_NEED_DIRTYFLUSH   0x02 /* waiting for dirty buffer flush */
 
#define VFS_BIO_NEED_FREE   0x04 /* wait for free bufs, hi hysteresis */
 
#define VFS_BIO_NEED_BUFSPACE   0x08 /* wait for buf space, lo hysteresis */
 
#define NSWBUF_MIN   16
 
#define TRANSIENT_DENOM   10
 
#define BUF_CHECK_MAPPED(bp)   do {} while (0)
 
#define BUF_CHECK_UNMAPPED(bp)   do {} while (0)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_BIOBUF,"biobuf","BIO buffer")
 
static int inmem (struct vnode *vp, daddr_t blkno)
 
static void vm_hold_free_pages (struct buf *bp, int newbsize)
 
static void vm_hold_load_pages (struct buf *bp, vm_offset_t from, vm_offset_t to)
 
static void vfs_page_set_valid (struct buf *bp, vm_ooffset_t off, vm_page_t m)
 
static void vfs_page_set_validclean (struct buf *bp, vm_ooffset_t off, vm_page_t m)
 
static void vfs_drain_busy_pages (struct buf *bp)
 
static void vfs_clean_pages_dirty_buf (struct buf *bp)
 
static void vfs_setdirty_locked_object (struct buf *bp)
 
static void vfs_vmio_release (struct buf *bp)
 
static int vfs_bio_clcheck (struct vnode *vp, int size, daddr_t lblkno, daddr_t blkno)
 
static int buf_do_flush (struct vnode *vp)
 
static int flushbufqueues (struct vnode *, int, int)
 
static void buf_daemon (void)
 
static void bremfreel (struct buf *bp)
 
 SYSCTL_INT (_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW,&vmiodirenable, 0,"Use the VM system for directory writes")
 
 SYSCTL_LONG (_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD,&runningbufspace, 0,"Amount of presently outstanding async buffer io")
 
 SYSCTL_LONG (_vfs, OID_AUTO, bufspace, CTLFLAG_RD,&bufspace, 0,"Virtual memory used for buffers")
 
 SYSCTL_LONG (_vfs, OID_AUTO, unmapped_bufspace, CTLFLAG_RD,&unmapped_bufspace, 0,"Amount of unmapped buffers, inclusive in the bufspace")
 
 SYSCTL_LONG (_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD,&maxbufspace, 0,"Maximum allowed value of bufspace (including buf_daemon)")
 
 SYSCTL_LONG (_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD,&bufmallocspace, 0,"Amount of malloced memory for buffers")
 
 SYSCTL_LONG (_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW,&maxbufmallocspace, 0,"Maximum amount of malloced memory for buffers")
 
 SYSCTL_LONG (_vfs, OID_AUTO, lobufspace, CTLFLAG_RD,&lobufspace, 0,"Minimum amount of buffers we want to have")
 
 SYSCTL_LONG (_vfs, OID_AUTO, hibufspace, CTLFLAG_RD,&hibufspace, 0,"Maximum allowed value of bufspace (excluding buf_daemon)")
 
 SYSCTL_INT (_vfs, OID_AUTO, bufreusecnt, CTLFLAG_RW,&bufreusecnt, 0,"Number of times we have reused a buffer")
 
 SYSCTL_INT (_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW,&buffreekvacnt, 0,"Number of times we have freed the KVA space from some buffer")
 
 SYSCTL_INT (_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW,&bufdefragcnt, 0,"Number of times we have had to repeat buffer allocation to defragment")
 
 SYSCTL_LONG (_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW,&lorunningspace, 0,"Minimum preferred space used for in-progress I/O")
 
 SYSCTL_LONG (_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW,&hirunningspace, 0,"Maximum amount of space to use for in-progress I/O")
 
 SYSCTL_INT (_vfs, OID_AUTO, dirtybufferflushes, CTLFLAG_RW,&dirtybufferflushes, 0,"Number of bdwrite to bawrite conversions to limit dirty buffers")
 
 SYSCTL_INT (_vfs, OID_AUTO, bdwriteskip, CTLFLAG_RW,&bdwriteskip, 0,"Number of buffers supplied to bdwrite with snapshot deadlock risk")
 
 SYSCTL_INT (_vfs, OID_AUTO, altbufferflushes, CTLFLAG_RW,&altbufferflushes, 0,"Number of fsync flushes to limit dirty buffers")
 
 SYSCTL_INT (_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW,&recursiveflushes, 0,"Number of flushes skipped due to being recursive")
 
 SYSCTL_INT (_vfs, OID_AUTO, numdirtybuffers, CTLFLAG_RD,&numdirtybuffers, 0,"Number of buffers that are dirty (has unwritten changes) at the moment")
 
 SYSCTL_INT (_vfs, OID_AUTO, lodirtybuffers, CTLFLAG_RW,&lodirtybuffers, 0,"How many buffers we want to have free before bufdaemon can sleep")
 
 SYSCTL_INT (_vfs, OID_AUTO, hidirtybuffers, CTLFLAG_RW,&hidirtybuffers, 0,"When the number of dirty buffers is considered severe")
 
 SYSCTL_INT (_vfs, OID_AUTO, dirtybufthresh, CTLFLAG_RW,&dirtybufthresh, 0,"Number of bdwrite to bawrite conversions to clear dirty buffers")
 
 SYSCTL_INT (_vfs, OID_AUTO, numfreebuffers, CTLFLAG_RD,&numfreebuffers, 0,"Number of free buffers")
 
 SYSCTL_INT (_vfs, OID_AUTO, lofreebuffers, CTLFLAG_RW,&lofreebuffers, 0,"XXX Unused")
 
 SYSCTL_INT (_vfs, OID_AUTO, hifreebuffers, CTLFLAG_RW,&hifreebuffers, 0,"XXX Complicatedly unused")
 
 SYSCTL_INT (_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RW,&getnewbufcalls, 0,"Number of calls to getnewbuf")
 
 SYSCTL_INT (_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW,&getnewbufrestarts, 0,"Number of times getnewbuf has had to restart a buffer aquisition")
 
 SYSCTL_INT (_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RW,&mappingrestarts, 0,"Number of times getblk has had to restart a buffer mapping for ""unmapped buffer")
 
 SYSCTL_INT (_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW,&flushbufqtarget, 0,"Amount of work to do in flushbufqueues when helping bufdaemon")
 
 SYSCTL_LONG (_vfs, OID_AUTO, notbufdflashes, CTLFLAG_RD,&notbufdflashes, 0,"Number of dirty buffer flushes done by the bufdaemon helpers")
 
 SYSCTL_LONG (_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW,&barrierwrites, 0,"Number of barrier writes")
 
 SYSCTL_INT (_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD,&unmapped_buf_allowed, 0,"Permit the use of the unmapped i/o")
 
static TAILQ_HEAD (bqueues, buf)
 
static __inline void numdirtywakeup (int level)
 
static __inline void bufspacewakeup (void)
 
void runningbufwakeup (struct buf *bp)
 
static __inline void bufcountwakeup (struct buf *bp)
 
void waitrunningbufspace (void)
 
static __inline void vfs_buf_test_cache (struct buf *bp, vm_ooffset_t foff, vm_offset_t off, vm_offset_t size, vm_page_t m)
 
static __inline void bd_wakeup (int dirtybuflevel)
 
void bd_speedup (void)
 
caddr_t kern_vfs_bio_buffer_alloc (caddr_t v, long physmem_est)
 
void bufinit (void)
 
static void bpmap_qenter (struct buf *bp)
 
static void bfreekva (struct buf *bp)
 
void bremfree (struct buf *bp)
 
void bremfreef (struct buf *bp)
 
int bread (struct vnode *vp, daddr_t blkno, int size, struct ucred *cred, struct buf **bpp)
 
void breada (struct vnode *vp, daddr_t *rablkno, int *rabsize, int cnt, struct ucred *cred)
 
int bread_gb (struct vnode *vp, daddr_t blkno, int cnt, struct ucred *cred, int gbflags, struct buf **bpp)
 
int breadn (struct vnode *vp, daddr_t blkno, int size, daddr_t *rablkno, int *rabsize, int cnt, struct ucred *cred, struct buf **bpp)
 
int breadn_flags (struct vnode *vp, daddr_t blkno, int size, daddr_t *rablkno, int *rabsize, int cnt, struct ucred *cred, int flags, struct buf **bpp)
 
int bufwrite (struct buf *bp)
 
void bufbdflush (struct bufobj *bo, struct buf *bp)
 
void bdwrite (struct buf *bp)
 
void bdirty (struct buf *bp)
 
void bundirty (struct buf *bp)
 
void bawrite (struct buf *bp)
 
void babarrierwrite (struct buf *bp)
 
int bbarrierwrite (struct buf *bp)
 
void bwillwrite (void)
 
int buf_dirty_count_severe (void)
 
static __noinline int buf_vm_page_count_severe (void)
 
void brelse (struct buf *bp)
 
void bqrelse (struct buf *bp)
 
int vfs_bio_awrite (struct buf *bp)
 
static void setbufkva (struct buf *bp, vm_offset_t addr, int maxsize, int gbflags)
 
static int allocbufkva (struct buf *bp, int maxsize, int gbflags)
 
static void getnewbuf_bufd_help (struct vnode *vp, int gbflags, int slpflag, int slptimeo, int defrag)
 
static void getnewbuf_reuse_bp (struct buf *bp, int qindex)
 
static struct bufgetnewbuf_scan (int maxsize, int defrag, int unmapped, int metadata)
 
static struct bufgetnewbuf (struct vnode *vp, int slpflag, int slptimeo, int size, int maxsize, int gbflags)
 
 SYSINIT (bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start,&buf_kp)
 
 SYSCTL_INT (_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW,&flushwithdeps, 0,"Number of buffers flushed with dependecies that require rollbacks")
 
struct bufincore (struct bufobj *bo, daddr_t blkno)
 
static void bp_unmapped_get_kva (struct buf *bp, daddr_t blkno, int size, int gbflags)
 
struct bufgetblk (struct vnode *vp, daddr_t blkno, int size, int slpflag, int slptimeo, int flags)
 
struct bufgeteblk (int size, int flags)
 
int allocbuf (struct buf *bp, int size)
 
void biodone (struct bio *bp)
 
int biowait (struct bio *bp, const char *wchan)
 
void biofinish (struct bio *bp, struct devstat *stat, int error)
 
int bufwait (struct buf *bp)
 
static void bufdonebio (struct bio *bip)
 
void dev_strategy (struct cdev *dev, struct buf *bp)
 
void dev_strategy_csw (struct cdev *dev, struct cdevsw *csw, struct buf *bp)
 
void bufdone (struct buf *bp)
 
void bufdone_finish (struct buf *bp)
 
void vfs_unbusy_pages (struct buf *bp)
 
void vfs_busy_pages (struct buf *bp, int clear_modify)
 
void vfs_bio_set_valid (struct buf *bp, int base, int size)
 
void vfs_bio_clrbuf (struct buf *bp)
 
void vfs_bio_bzero_buf (struct buf *bp, int base, int size)
 
int vmapbuf (struct buf *bp, int mapbuf)
 
void vunmapbuf (struct buf *bp)
 
void bdone (struct buf *bp)
 
void bwait (struct buf *bp, u_char pri, const char *wchan)
 
int bufsync (struct bufobj *bo, int waitfor)
 
void bufstrategy (struct bufobj *bo, struct buf *bp)
 
void bufobj_wrefl (struct bufobj *bo)
 
void bufobj_wref (struct bufobj *bo)
 
void bufobj_wdrop (struct bufobj *bo)
 
int bufobj_wwait (struct bufobj *bo, int slpflag, int timeo)
 
void bpin (struct buf *bp)
 
void bunpin (struct buf *bp)
 
void bunpin_wait (struct buf *bp)
 
void bdata2bio (struct buf *bp, struct bio *bip)
 

Variables

struct bio_ops bioops
 
struct buf_ops buf_ops_bio
 
struct buf * buf
 
caddr_t unmapped_buf
 
static struct proc * bufdaemonproc
 
int vmiodirenable = TRUE
 
long runningbufspace
 
static long bufspace
 
static long unmapped_bufspace
 
static long maxbufspace
 
static long bufmallocspace
 
static long maxbufmallocspace
 
static long lobufspace
 
long hibufspace
 
static int bufreusecnt
 
static int buffreekvacnt
 
static int bufdefragcnt
 
static long lorunningspace
 
static long hirunningspace
 
int dirtybufferflushes
 
int bdwriteskip
 
int altbufferflushes
 
static int recursiveflushes
 
static int numdirtybuffers
 
static int lodirtybuffers
 
static int hidirtybuffers
 
int dirtybufthresh
 
static int numfreebuffers
 
static int lofreebuffers
 
static int hifreebuffers
 
static int getnewbufcalls
 
static int getnewbufrestarts
 
static int mappingrestarts
 
static int flushbufqtarget = 100
 
static long notbufdflashes
 
static long barrierwrites
 
static int bd_request
 
static int bd_speedupreq
 
static struct mtx bdlock
 
vm_page_t bogus_page
 
static int runningbufreq
 
static struct mtx rbreqlock
 
static int needsbuffer
 
static struct mtx nblock
 
static struct mtx bqlock
 
const char * buf_wmesg = BUF_WMESG
 
static int flushingbufs
 
static struct kproc_desc buf_kp
 
static int flushwithdeps = 0
 
int inflight_transient_maps
 

Macro Definition Documentation

#define BUF_CHECK_UNMAPPED (   bp)    do {} while (0)
#define BUFFER_QUEUES   6 /* number of free buffer queues */

Definition at line 288 of file vfs_bio.c.

Referenced by bufinit().

#define NSWBUF_MIN   16

Definition at line 524 of file vfs_bio.c.

Referenced by kern_vfs_bio_buffer_alloc().

#define QUEUE_CLEAN   1 /* non-B_DELWRI buffers */

Definition at line 291 of file vfs_bio.c.

Referenced by bqrelse(), brelse(), getnewbuf_reuse_bp(), and getnewbuf_scan().

#define QUEUE_DIRTY   2 /* B_DELWRI buffers */

Definition at line 292 of file vfs_bio.c.

Referenced by bqrelse(), brelse(), and buf_do_flush().

#define QUEUE_DIRTY_GIANT   3 /* B_DELWRI buffers that need giant */

Definition at line 293 of file vfs_bio.c.

Referenced by bqrelse(), brelse(), and buf_do_flush().

#define QUEUE_EMPTY   5 /* empty buffer headers */

Definition at line 295 of file vfs_bio.c.

Referenced by brelse(), bufinit(), and getnewbuf_scan().

#define QUEUE_EMPTYKVA   4 /* empty buffer headers w/KVA assignment */

Definition at line 294 of file vfs_bio.c.

Referenced by brelse(), and getnewbuf_scan().

#define QUEUE_NONE   0 /* on no queue */

Definition at line 290 of file vfs_bio.c.

Referenced by bdirty(), bqrelse(), brelse(), bremfree(), bremfreel(), and bundirty().

#define QUEUE_SENTINEL   1024 /* not an queue index, but mark for sentinel */

Definition at line 296 of file vfs_bio.c.

Referenced by flushbufqueues().

#define TRANSIENT_DENOM   10

Definition at line 530 of file vfs_bio.c.

Referenced by kern_vfs_bio_buffer_alloc().

#define VFS_BIO_NEED_ANY   0x01 /* any freeable buffer */

Definition at line 313 of file vfs_bio.c.

Referenced by bufcountwakeup(), getblk(), and getnewbuf_bufd_help().

#define VFS_BIO_NEED_BUFSPACE   0x08 /* wait for buf space, lo hysteresis */

Definition at line 316 of file vfs_bio.c.

Referenced by bufspacewakeup(), and getnewbuf_bufd_help().

#define VFS_BIO_NEED_DIRTYFLUSH   0x02 /* waiting for dirty buffer flush */

Definition at line 314 of file vfs_bio.c.

Referenced by bwillwrite(), and numdirtywakeup().

#define VFS_BIO_NEED_FREE   0x04 /* wait for free bufs, hi hysteresis */

Definition at line 315 of file vfs_bio.c.

Referenced by bufcountwakeup().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
int allocbuf ( struct buf bp,
int  size 
)

Definition at line 3390 of file vfs_bio.c.

References bogus_page, bpmap_qenter(), BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, bufmallocspace, bufspacewakeup(), free(), malloc(), maxbufmallocspace, panic(), vfs_buf_test_cache(), vm_hold_free_pages(), and vm_hold_load_pages().

Referenced by brelse(), getblk(), geteblk(), and getnewbuf_reuse_bp().

Here is the call graph for this function:

Here is the caller graph for this function:

static int allocbufkva ( struct buf bp,
int  maxsize,
int  gbflags 
)
static

Definition at line 2050 of file vfs_bio.c.

References bfreekva(), bufdefragcnt, bufspace, and setbufkva().

Referenced by bp_unmapped_get_kva(), and getnewbuf().

Here is the call graph for this function:

Here is the caller graph for this function:

void babarrierwrite ( struct buf bp)

Definition at line 1374 of file vfs_bio.c.

void bawrite ( struct buf bp)

Definition at line 1357 of file vfs_bio.c.

Referenced by bufbdflush(), cluster_wbuild_gb(), cluster_write_gb(), vop_stdfsync(), and vtruncbuf().

Here is the caller graph for this function:

int bbarrierwrite ( struct buf bp)

Definition at line 1391 of file vfs_bio.c.

void bd_speedup ( void  )

Definition at line 508 of file vfs_bio.c.

References bd_request, bd_speedupreq, bdlock, and wakeup().

Referenced by getnewbuf_bufd_help().

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline void bd_wakeup ( int  dirtybuflevel)
static

Definition at line 492 of file vfs_bio.c.

References bd_request, bdlock, numdirtybuffers, and wakeup().

Referenced by bdirty(), bdwrite(), and bwillwrite().

Here is the call graph for this function:

Here is the caller graph for this function:

void bdata2bio ( struct buf bp,
struct bio *  bip 
)

Definition at line 4559 of file vfs_bio.c.

References unmapped_buf.

Referenced by dev_strategy_csw().

Here is the caller graph for this function:

void bdirty ( struct buf bp)

Definition at line 1294 of file vfs_bio.c.

References bd_wakeup(), hidirtybuffers, lodirtybuffers, numdirtybuffers, QUEUE_NONE, and reassignbuf().

Referenced by bdwrite(), and brelse().

Here is the call graph for this function:

Here is the caller graph for this function:

void bdone ( struct buf bp)

Definition at line 4425 of file vfs_bio.c.

References mtx_pool_find(), mtxpool_sleep, and wakeup().

Referenced by bufdone_finish(), and physio().

Here is the call graph for this function:

Here is the caller graph for this function:

void bdwrite ( struct buf bp)

Definition at line 1195 of file vfs_bio.c.

References bd_wakeup(), bdirty(), bqrelse(), brelse(), hidirtybuffers, lodirtybuffers, recursiveflushes, and vfs_clean_pages_dirty_buf().

Referenced by cluster_write_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

static void bfreekva ( struct buf bp)
static

Definition at line 814 of file vfs_bio.c.

References BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, buffreekvacnt, bufspace, bufspacewakeup(), and unmapped_bufspace.

Referenced by allocbufkva(), getnewbuf(), and getnewbuf_scan().

Here is the call graph for this function:

Here is the caller graph for this function:

void biodone ( struct bio *  bp)

Definition at line 3644 of file vfs_bio.c.

References mtx_pool_find(), mtxpool_sleep, start, and wakeup().

Referenced by biofinish(), and bufdone().

Here is the call graph for this function:

Here is the caller graph for this function:

void biofinish ( struct bio *  bp,
struct devstat *  stat,
int  error 
)

Definition at line 3699 of file vfs_bio.c.

References biodone(), and devstat_end_transaction_bio().

Referenced by bioq_flush(), dead_strategy(), giant_strategy(), and no_strategy().

Here is the call graph for this function:

Here is the caller graph for this function:

int biowait ( struct bio *  bp,
const char *  wchan 
)

Definition at line 3682 of file vfs_bio.c.

References hz, mtx_pool_find(), and mtxpool_sleep.

Here is the call graph for this function:

static void bp_unmapped_get_kva ( struct buf bp,
daddr_t  blkno,
int  size,
int  gbflags 
)
static

Definition at line 2979 of file vfs_bio.c.

References allocbufkva(), bpmap_qenter(), brelse(), buf, BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, getnewbuf(), mappingrestarts, panic(), setbufkva(), unmapped_bufspace, and vn_isdisk().

Referenced by getblk().

Here is the call graph for this function:

Here is the caller graph for this function:

void bpin ( struct buf bp)

Definition at line 4521 of file vfs_bio.c.

References mtx_pool_find(), and mtxpool_sleep.

Here is the call graph for this function:

static void bpmap_qenter ( struct buf bp)
static

Definition at line 793 of file vfs_bio.c.

References BUF_CHECK_MAPPED.

Referenced by allocbuf(), and bp_unmapped_get_kva().

Here is the caller graph for this function:

void bqrelse ( struct buf bp)

Definition at line 1760 of file vfs_bio.c.

References bqlock, brelse(), bremfreel(), buf_vm_page_count_severe(), bufcountwakeup(), bufspacewakeup(), panic(), QUEUE_CLEAN, QUEUE_DIRTY, QUEUE_DIRTY_GIANT, and QUEUE_NONE.

Referenced by bdwrite(), brelse(), bufdone_finish(), cluster_rbuild(), cluster_read_gb(), cluster_wbuild_gb(), and getblk().

Here is the call graph for this function:

Here is the caller graph for this function:

int bread ( struct vnode *  vp,
daddr_t  blkno,
int  size,
struct ucred *  cred,
struct buf **  bpp 
)

Definition at line 937 of file vfs_bio.c.

References breadn_flags().

Here is the call graph for this function:

int bread_gb ( struct vnode *  vp,
daddr_t  blkno,
int  cnt,
struct ucred *  cred,
int  gbflags,
struct buf **  bpp 
)

Definition at line 984 of file vfs_bio.c.

References breadn_flags().

Referenced by cluster_collectbufs().

Here is the call graph for this function:

Here is the caller graph for this function:

void breada ( struct vnode *  vp,
daddr_t *  rablkno,
int *  rabsize,
int  cnt,
struct ucred *  cred 
)

Definition at line 950 of file vfs_bio.c.

References brelse(), buf, crhold(), getblk(), inmem(), and vfs_busy_pages().

Referenced by breadn_flags().

Here is the call graph for this function:

Here is the caller graph for this function:

int breadn ( struct vnode *  vp,
daddr_t  blkno,
int  size,
daddr_t *  rablkno,
int *  rabsize,
int  cnt,
struct ucred *  cred,
struct buf **  bpp 
)

Definition at line 997 of file vfs_bio.c.

References breadn_flags().

Here is the call graph for this function:

int breadn_flags ( struct vnode *  vp,
daddr_t  blkno,
int  size,
daddr_t *  rablkno,
int *  rabsize,
int  cnt,
struct ucred *  cred,
int  flags,
struct buf **  bpp 
)

Definition at line 1015 of file vfs_bio.c.

References breada(), buf, bufwait(), crhold(), getblk(), and vfs_busy_pages().

Referenced by bread(), bread_gb(), and breadn().

Here is the call graph for this function:

Here is the caller graph for this function:

void bremfree ( struct buf bp)

Definition at line 846 of file vfs_bio.c.

References numfreebuffers, and QUEUE_NONE.

Referenced by bufbdflush(), cluster_wbuild_gb(), flushbuflist(), flushbufqueues(), getblk(), vfs_bio_awrite(), vop_stdfsync(), and vtruncbuf().

Here is the caller graph for this function:

void bremfreef ( struct buf bp)

Definition at line 877 of file vfs_bio.c.

References bqlock, and bremfreel().

Here is the call graph for this function:

static void bremfreel ( struct buf bp)
static

Definition at line 891 of file vfs_bio.c.

References bqlock, numfreebuffers, and QUEUE_NONE.

Referenced by bqrelse(), brelse(), bremfreef(), flushbufqueues(), and getnewbuf_scan().

Here is the caller graph for this function:

static void buf_daemon ( void  )
static

Definition at line 2589 of file vfs_bio.c.

References bd_request, bd_speedupreq, bdlock, buf_do_flush(), bufdaemonproc, hz, kern_yield(), kproc_shutdown(), kproc_suspend_check(), lodirtybuffers, and numdirtybuffers.

Here is the call graph for this function:

int buf_dirty_count_severe ( void  )

Definition at line 1428 of file vfs_bio.c.

References hidirtybuffers, and numdirtybuffers.

static int buf_do_flush ( struct vnode *  vp)
static

Definition at line 2560 of file vfs_bio.c.

References flushbufqueues(), Giant, QUEUE_DIRTY, and QUEUE_DIRTY_GIANT.

Referenced by buf_daemon(), and getnewbuf_bufd_help().

Here is the call graph for this function:

Here is the caller graph for this function:

static __noinline int buf_vm_page_count_severe ( void  )
static

Definition at line 1435 of file vfs_bio.c.

Referenced by bqrelse(), brelse(), and vfs_vmio_release().

Here is the caller graph for this function:

void bufbdflush ( struct bufobj *  bo,
struct buf bp 
)

Definition at line 1145 of file vfs_bio.c.

References altbufferflushes, bawrite(), bremfree(), buf, dirtybufferflushes, dirtybufthresh, panic(), and vfs_bio_awrite().

Here is the call graph for this function:

static __inline void bufcountwakeup ( struct buf bp)
static

Definition at line 417 of file vfs_bio.c.

References hifreebuffers, nblock, nbuf, needsbuffer, numfreebuffers, VFS_BIO_NEED_ANY, VFS_BIO_NEED_FREE, and wakeup().

Referenced by bqrelse(), and brelse().

Here is the call graph for this function:

Here is the caller graph for this function:

void bufdone ( struct buf bp)

Definition at line 3825 of file vfs_bio.c.

References biodone(), buf, bufdone_finish(), bufobj_wdrop(), and runningbufwakeup().

Referenced by bufdonebio(), cluster_callback(), dev_strategy_csw(), and vop_nostrategy().

Here is the call graph for this function:

Here is the caller graph for this function:

void bufdone_finish ( struct buf bp)

Definition at line 3856 of file vfs_bio.c.

References bdone(), bogus_page, bqrelse(), brelse(), BUF_CHECK_MAPPED, panic(), and vfs_page_set_valid().

Referenced by bufdone().

Here is the call graph for this function:

Here is the caller graph for this function:

static void bufdonebio ( struct bio *  bip)
static

Definition at line 3740 of file vfs_bio.c.

References buf, and bufdone().

Referenced by dev_strategy_csw().

Here is the call graph for this function:

Here is the caller graph for this function:

void bufobj_wdrop ( struct bufobj *  bo)

Definition at line 4489 of file vfs_bio.c.

References wakeup().

Referenced by bufdone().

Here is the call graph for this function:

Here is the caller graph for this function:

void bufobj_wref ( struct bufobj *  bo)

Definition at line 4479 of file vfs_bio.c.

Referenced by bufwrite(), and cluster_wbuild_gb().

Here is the caller graph for this function:

void bufobj_wrefl ( struct bufobj *  bo)

Definition at line 4470 of file vfs_bio.c.

int bufobj_wwait ( struct bufobj *  bo,
int  slpflag,
int  timeo 
)

Definition at line 4503 of file vfs_bio.c.

Referenced by bufobj_invalbuf(), vop_stdfsync(), and vtruncbuf().

Here is the caller graph for this function:

static __inline void bufspacewakeup ( void  )
static

Definition at line 371 of file vfs_bio.c.

References nblock, needsbuffer, VFS_BIO_NEED_BUFSPACE, and wakeup().

Referenced by allocbuf(), bfreekva(), bqrelse(), brelse(), and vfs_vmio_release().

Here is the call graph for this function:

Here is the caller graph for this function:

void bufstrategy ( struct bufobj *  bo,
struct buf bp 
)

Definition at line 4456 of file vfs_bio.c.

int bufsync ( struct bufobj *  bo,
int  waitfor 
)

Definition at line 4449 of file vfs_bio.c.

int bufwait ( struct buf bp)

Definition at line 3719 of file vfs_bio.c.

References bwait().

Referenced by breadn_flags(), bufwrite(), and cluster_read_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

int bufwrite ( struct buf bp)

Definition at line 1064 of file vfs_bio.c.

References barrierwrites, brelse(), bufobj_wref(), bufwait(), bundirty(), bunpin_wait(), runningbufspace, vfs_busy_pages(), and waitrunningbufspace().

Here is the call graph for this function:

void bundirty ( struct buf bp)

Definition at line 1326 of file vfs_bio.c.

References lodirtybuffers, numdirtybuffers, numdirtywakeup(), QUEUE_NONE, and reassignbuf().

Referenced by brelse(), bufwrite(), and cluster_wbuild_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

void bunpin ( struct buf bp)

Definition at line 4532 of file vfs_bio.c.

References mtx_pool_find(), mtxpool_sleep, and wakeup().

Here is the call graph for this function:

void bunpin_wait ( struct buf bp)

Definition at line 4544 of file vfs_bio.c.

References mtx_pool_find(), and mtxpool_sleep.

Referenced by bufwrite(), and getblk().

Here is the call graph for this function:

Here is the caller graph for this function:

void bwait ( struct buf bp,
u_char  pri,
const char *  wchan 
)

Definition at line 4437 of file vfs_bio.c.

References mtx_pool_find(), and mtxpool_sleep.

Referenced by bufwait(), and physio().

Here is the call graph for this function:

Here is the caller graph for this function:

void bwillwrite ( void  )
void dev_strategy ( struct cdev *  dev,
struct buf bp 
)

Definition at line 3756 of file vfs_bio.c.

References dev_refthread(), dev_relthread(), dev_strategy_csw(), and devtoname().

Here is the call graph for this function:

void dev_strategy_csw ( struct cdev *  dev,
struct cdevsw *  csw,
struct buf bp 
)

Definition at line 3771 of file vfs_bio.c.

References bdata2bio(), bufdone(), bufdonebio(), devtoname(), and hz.

Referenced by aio_qphysio(), dev_strategy(), and physio().

Here is the call graph for this function:

Here is the caller graph for this function:

static int flushbufqueues ( struct vnode *  lvp,
int  queue,
int  flushdeps 
)
static

Definition at line 2669 of file vfs_bio.c.

References bqlock, brelse(), bremfree(), bremfreel(), buf, bufdaemonproc, flushbufqtarget, free(), hidirtybuffers, lodirtybuffers, malloc(), notbufdflashes, numdirtybuffers, numdirtywakeup(), QUEUE_SENTINEL, vfs_bio_awrite(), vn_finished_write(), vn_start_write(), and waitrunningbufspace().

Referenced by buf_do_flush().

Here is the call graph for this function:

Here is the caller graph for this function:

struct buf* getblk ( struct vnode *  vp,
daddr_t  blkno,
int  size,
int  slpflag,
int  slptimeo,
int  flags 
)

Definition at line 3094 of file vfs_bio.c.

References allocbuf(), bgetvp(), bp_unmapped_get_kva(), bqrelse(), brelse(), bremfree(), buf, BUF_CHECK_MAPPED, bunpin_wait(), gbincore(), getnewbuf(), nblock, needsbuffer, numfreebuffers, panic(), VFS_BIO_NEED_ANY, and vn_isdisk().

Referenced by breada(), breadn_flags(), cluster_rbuild(), and cluster_read_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

struct buf* geteblk ( int  size,
int  flags 
)

Definition at line 3356 of file vfs_bio.c.

References allocbuf(), buf, and getnewbuf().

Here is the call graph for this function:

static struct buf* getnewbuf ( struct vnode *  vp,
int  slpflag,
int  slptimeo,
int  size,
int  maxsize,
int  gbflags 
)
static

Definition at line 2437 of file vfs_bio.c.

References allocbufkva(), bfreekva(), bqlock, brelse(), buf, BUF_CHECK_MAPPED, bufreusecnt, bufspace, getnewbuf_bufd_help(), getnewbuf_scan(), getnewbufcalls, getnewbufrestarts, unmapped_buf, and unmapped_bufspace.

Referenced by bp_unmapped_get_kva(), getblk(), and geteblk().

Here is the call graph for this function:

Here is the caller graph for this function:

static void getnewbuf_bufd_help ( struct vnode *  vp,
int  gbflags,
int  slpflag,
int  slptimeo,
int  defrag 
)
static

Definition at line 2083 of file vfs_bio.c.

References bd_speedup(), bqlock, buf_do_flush(), bufspace, hibufspace, nblock, needsbuffer, VFS_BIO_NEED_ANY, and VFS_BIO_NEED_BUFSPACE.

Referenced by getnewbuf().

Here is the call graph for this function:

Here is the caller graph for this function:

static void getnewbuf_reuse_bp ( struct buf bp,
int  qindex 
)
static

Definition at line 2145 of file vfs_bio.c.

References allocbuf(), bqlock, brelvp(), crfree(), panic(), QUEUE_CLEAN, and vfs_vmio_release().

Referenced by getnewbuf_scan().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct buf* getnewbuf_scan ( int  maxsize,
int  defrag,
int  unmapped,
int  metadata 
)
static

Definition at line 2221 of file vfs_bio.c.

References bfreekva(), bqlock, brelse(), bremfreel(), buf, bufspace, getnewbuf_reuse_bp(), getnewbufrestarts, hibufspace, lobufspace, printf(), QUEUE_CLEAN, QUEUE_EMPTY, and QUEUE_EMPTYKVA.

Referenced by getnewbuf().

Here is the call graph for this function:

Here is the caller graph for this function:

struct buf* incore ( struct bufobj *  bo,
daddr_t  blkno 
)

Definition at line 2809 of file vfs_bio.c.

References buf, and gbincore().

Referenced by inmem().

Here is the call graph for this function:

Here is the caller graph for this function:

static int inmem ( struct vnode *  vp,
daddr_t  blkno 
)
static

Definition at line 2826 of file vfs_bio.c.

References incore().

Referenced by breada().

Here is the call graph for this function:

Here is the caller graph for this function:

caddr_t kern_vfs_bio_buffer_alloc ( caddr_t  v,
long  physmem_est 
)

Definition at line 540 of file vfs_bio.c.

References bio_transient_maxcnt, buf, maxbcache, nbuf, nswbuf, NSWBUF_MIN, printf(), swbuf, and TRANSIENT_DENOM.

Here is the call graph for this function:

static MALLOC_DEFINE ( M_BIOBUF  ,
"biobuf"  ,
"BIO buffer"   
)
static
static __inline void numdirtywakeup ( int  level)
static

Definition at line 348 of file vfs_bio.c.

References nblock, needsbuffer, numdirtybuffers, VFS_BIO_NEED_DIRTYFLUSH, and wakeup().

Referenced by brelse(), bundirty(), and flushbufqueues().

Here is the call graph for this function:

Here is the caller graph for this function:

void runningbufwakeup ( struct buf bp)

Definition at line 392 of file vfs_bio.c.

References lorunningspace, rbreqlock, runningbufreq, runningbufspace, and wakeup().

Referenced by bufdone(), and vfs_unbusy_pages().

Here is the call graph for this function:

Here is the caller graph for this function:

static void setbufkva ( struct buf bp,
vm_offset_t  addr,
int  maxsize,
int  gbflags 
)
static

Definition at line 2028 of file vfs_bio.c.

References unmapped_bufspace.

Referenced by allocbufkva(), and bp_unmapped_get_kva().

Here is the caller graph for this function:

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
vmiodirenable  ,
CTLFLAG_RW  ,
vmiodirenable,
,
"Use the VM system for directory writes"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
bufreusecnt  ,
CTLFLAG_RW  ,
bufreusecnt,
,
"Number of times we have reused a buffer"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
buffreekvacnt  ,
CTLFLAG_RW  ,
buffreekvacnt,
,
"Number of times we have freed the KVA space from some buffer"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
bufdefragcnt  ,
CTLFLAG_RW  ,
bufdefragcnt,
,
"Number of times we have had to repeat buffer allocation to defragment"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
dirtybufferflushes  ,
CTLFLAG_RW  ,
dirtybufferflushes,
,
"Number of bdwrite to bawrite conversions to limit dirty buffers"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
bdwriteskip  ,
CTLFLAG_RW  ,
bdwriteskip,
,
"Number of buffers supplied to bdwrite with snapshot deadlock risk"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
altbufferflushes  ,
CTLFLAG_RW  ,
altbufferflushes,
,
"Number of fsync flushes to limit dirty buffers"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
recursiveflushes  ,
CTLFLAG_RW  ,
recursiveflushes,
,
"Number of flushes skipped due to being recursive"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
numdirtybuffers  ,
CTLFLAG_RD  ,
numdirtybuffers,
,
"Number of buffers that are dirty (has unwritten changes) at the moment"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
lodirtybuffers  ,
CTLFLAG_RW  ,
lodirtybuffers,
,
"How many buffers we want to have free before bufdaemon can sleep"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
hidirtybuffers  ,
CTLFLAG_RW  ,
hidirtybuffers,
,
"When the number of dirty buffers is considered severe"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
dirtybufthresh  ,
CTLFLAG_RW  ,
dirtybufthresh,
,
"Number of bdwrite to bawrite conversions to clear dirty buffers"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
numfreebuffers  ,
CTLFLAG_RD  ,
numfreebuffers,
,
"Number of free buffers"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
lofreebuffers  ,
CTLFLAG_RW  ,
lofreebuffers,
,
"XXX Unused"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
hifreebuffers  ,
CTLFLAG_RW  ,
hifreebuffers,
,
"XXX Complicatedly unused"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
getnewbufcalls  ,
CTLFLAG_RW  ,
getnewbufcalls,
,
"Number of calls to getnewbuf  
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
getnewbufrestarts  ,
CTLFLAG_RW  ,
getnewbufrestarts,
,
"Number of times getnewbuf has had to restart a buffer aquisition"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
mappingrestarts  ,
CTLFLAG_RW  ,
mappingrestarts,
,
"Number of times getblk has had to restart a buffer mapping for ""unmapped buffer"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
flushbufqtarget  ,
CTLFLAG_RW  ,
flushbufqtarget,
,
"Amount of work to do in flushbufqueues when helping bufdaemon"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
unmapped_buf_allowed  ,
CTLFLAG_RD  ,
unmapped_buf_allowed,
,
"Permit the use of the unmapped i/o"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
flushwithdeps  ,
CTLFLAG_RW  ,
flushwithdeps,
,
"Number of buffers flushed with dependecies that require rollbacks"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
runningbufspace  ,
CTLFLAG_RD  ,
runningbufspace,
,
"Amount of presently outstanding async buffer io"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
bufspace  ,
CTLFLAG_RD  ,
bufspace,
,
"Virtual memory used for buffers"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
unmapped_bufspace  ,
CTLFLAG_RD  ,
unmapped_bufspace,
,
"Amount of unmapped  buffers,
inclusive in the bufspace  
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
maxbufspace  ,
CTLFLAG_RD  ,
maxbufspace,
,
"Maximum allowed value of bufspace (including buf_daemon)"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
bufmallocspace  ,
CTLFLAG_RD  ,
bufmallocspace,
,
"Amount of malloced memory for buffers"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
maxmallocbufspace  ,
CTLFLAG_RW  ,
maxbufmallocspace,
,
"Maximum amount of malloced memory for buffers"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
lobufspace  ,
CTLFLAG_RD  ,
lobufspace,
,
"Minimum amount of buffers we want to have"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
hibufspace  ,
CTLFLAG_RD  ,
hibufspace,
,
"Maximum allowed value of bufspace (excluding buf_daemon)"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
lorunningspace  ,
CTLFLAG_RW  ,
lorunningspace,
,
"Minimum preferred space used for in-progress I/O"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
hirunningspace  ,
CTLFLAG_RW  ,
hirunningspace,
,
"Maximum amount of space to use for in-progress I/O"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
notbufdflashes  ,
CTLFLAG_RD  ,
notbufdflashes,
,
"Number of dirty buffer flushes done by the bufdaemon helpers"   
)
SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
barrierwrites  ,
CTLFLAG_RW  ,
barrierwrites,
,
"Number of barrier writes"   
)
SYSINIT ( bufdaemon  ,
SI_SUB_KTHREAD_BUF  ,
SI_ORDER_FIRST  ,
kproc_start  ,
buf_kp 
)
static TAILQ_HEAD ( bqueues  ,
buf   
)
static

Definition at line 299 of file vfs_bio.c.

int vfs_bio_awrite ( struct buf bp)

Definition at line 1964 of file vfs_bio.c.

References bremfree(), cluster_wbuild_gb(), and vfs_bio_clcheck().

Referenced by bufbdflush(), flushbufqueues(), and vop_stdfsync().

Here is the call graph for this function:

Here is the caller graph for this function:

void vfs_bio_bzero_buf ( struct buf bp,
int  base,
int  size 
)

Definition at line 4272 of file vfs_bio.c.

References BUF_CHECK_MAPPED, and BUF_CHECK_UNMAPPED.

static int vfs_bio_clcheck ( struct vnode *  vp,
int  size,
daddr_t  lblkno,
daddr_t  blkno 
)
static

Definition at line 1921 of file vfs_bio.c.

References buf, and gbincore().

Referenced by vfs_bio_awrite().

Here is the call graph for this function:

Here is the caller graph for this function:

void vfs_bio_clrbuf ( struct buf bp)

Definition at line 4215 of file vfs_bio.c.

References bogus_page, and mask.

void vfs_bio_set_valid ( struct buf bp,
int  base,
int  size 
)

Definition at line 4173 of file vfs_bio.c.

static __inline void vfs_buf_test_cache ( struct buf bp,
vm_ooffset_t  foff,
vm_offset_t  off,
vm_offset_t  size,
vm_page_t  m 
)
static

Definition at line 476 of file vfs_bio.c.

Referenced by allocbuf().

Here is the caller graph for this function:

void vfs_busy_pages ( struct buf bp,
int  clear_modify 
)

Definition at line 4105 of file vfs_bio.c.

References bogus_page, BUF_CHECK_MAPPED, vfs_drain_busy_pages(), vfs_page_set_validclean(), and vfs_setdirty_locked_object().

Referenced by breada(), breadn_flags(), bufwrite(), and cluster_read_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

static void vfs_clean_pages_dirty_buf ( struct buf bp)
static

Definition at line 2881 of file vfs_bio.c.

References vfs_drain_busy_pages(), vfs_page_set_validclean(), and vfs_setdirty_locked_object().

Referenced by bdwrite().

Here is the call graph for this function:

Here is the caller graph for this function:

static void vfs_drain_busy_pages ( struct buf bp)
static

Definition at line 4072 of file vfs_bio.c.

Referenced by vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

static void vfs_page_set_valid ( struct buf bp,
vm_ooffset_t  off,
vm_page_t  m 
)
static

Definition at line 4010 of file vfs_bio.c.

Referenced by bufdone_finish().

Here is the caller graph for this function:

static void vfs_page_set_validclean ( struct buf bp,
vm_ooffset_t  off,
vm_page_t  m 
)
static

Definition at line 4039 of file vfs_bio.c.

Referenced by vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

static void vfs_setdirty_locked_object ( struct buf bp)
static

Definition at line 2911 of file vfs_bio.c.

Referenced by vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

void vfs_unbusy_pages ( struct buf bp)

Definition at line 3968 of file vfs_bio.c.

References bogus_page, BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, panic(), and runningbufwakeup().

Here is the call graph for this function:

static void vfs_vmio_release ( struct buf bp)
static

Definition at line 1862 of file vfs_bio.c.

References brelvp(), BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, buf_vm_page_count_severe(), and bufspacewakeup().

Referenced by brelse(), and getnewbuf_reuse_bp().

Here is the call graph for this function:

Here is the caller graph for this function:

static void vm_hold_free_pages ( struct buf bp,
int  newbsize 
)
static

Definition at line 4336 of file vfs_bio.c.

References BUF_CHECK_MAPPED, and printf().

Referenced by allocbuf().

Here is the call graph for this function:

Here is the caller graph for this function:

static void vm_hold_load_pages ( struct buf bp,
vm_offset_t  from,
vm_offset_t  to 
)
static

Definition at line 4303 of file vfs_bio.c.

References BUF_CHECK_MAPPED.

Referenced by allocbuf().

Here is the caller graph for this function:

int vmapbuf ( struct buf bp,
int  mapbuf 
)

Definition at line 4374 of file vfs_bio.c.

References unmapped_buf.

Referenced by aio_qphysio(), and physio().

Here is the caller graph for this function:

void vunmapbuf ( struct buf bp)

Definition at line 4410 of file vfs_bio.c.

Referenced by biohelper(), and physio().

Here is the caller graph for this function:

void waitrunningbufspace ( void  )

Definition at line 455 of file vfs_bio.c.

References hirunningspace, rbreqlock, runningbufreq, and runningbufspace.

Referenced by bufwrite(), and flushbufqueues().

Here is the caller graph for this function:

Variable Documentation

int altbufferflushes

Definition at line 179 of file vfs_bio.c.

Referenced by bufbdflush().

long barrierwrites
static

Definition at line 222 of file vfs_bio.c.

Referenced by bufwrite().

int bd_request
static

Definition at line 234 of file vfs_bio.c.

Referenced by bd_speedup(), bd_wakeup(), and buf_daemon().

int bd_speedupreq
static

Definition at line 242 of file vfs_bio.c.

Referenced by bd_speedup(), and buf_daemon().

struct mtx bdlock
static

Definition at line 247 of file vfs_bio.c.

Referenced by bd_speedup(), bd_wakeup(), buf_daemon(), and bufinit().

int bdwriteskip

Definition at line 176 of file vfs_bio.c.

struct bio_ops bioops

Definition at line 83 of file vfs_bio.c.

vm_page_t bogus_page
struct kproc_desc buf_kp
static
Initial value:
= {
"bufdaemon",
}
static void buf_daemon(void)
Definition: vfs_bio.c:2589
static struct proc * bufdaemonproc
Definition: vfs_bio.c:100

Definition at line 2552 of file vfs_bio.c.

struct buf_ops buf_ops_bio
Initial value:
= {
.bop_name = "buf_ops_bio",
.bop_write = bufwrite,
.bop_strategy = bufstrategy,
.bop_sync = bufsync,
.bop_bdflush = bufbdflush,
}
void bufbdflush(struct bufobj *bo, struct buf *bp)
Definition: vfs_bio.c:1145
void bufstrategy(struct bufobj *bo, struct buf *bp)
Definition: vfs_bio.c:4456
int bufsync(struct bufobj *bo, int waitfor)
Definition: vfs_bio.c:4449
int bufwrite(struct buf *bp)
Definition: vfs_bio.c:1064

Definition at line 85 of file vfs_bio.c.

Referenced by getnewvnode().

const char* buf_wmesg = BUF_WMESG

Definition at line 311 of file vfs_bio.c.

struct proc* bufdaemonproc
static

Definition at line 100 of file vfs_bio.c.

Referenced by buf_daemon(), and flushbufqueues().

int bufdefragcnt
static

Definition at line 164 of file vfs_bio.c.

Referenced by allocbufkva().

int buffreekvacnt
static

Definition at line 161 of file vfs_bio.c.

Referenced by bfreekva().

long bufmallocspace
static

Definition at line 146 of file vfs_bio.c.

Referenced by allocbuf().

int bufreusecnt
static

Definition at line 158 of file vfs_bio.c.

Referenced by getnewbuf().

long bufspace
static

Definition at line 130 of file vfs_bio.c.

Referenced by allocbufkva(), bfreekva(), getnewbuf(), getnewbuf_bufd_help(), and getnewbuf_scan().

int dirtybufferflushes

Definition at line 173 of file vfs_bio.c.

Referenced by bufbdflush().

int dirtybufthresh

Definition at line 194 of file vfs_bio.c.

Referenced by bufbdflush(), and bufinit().

int flushbufqtarget = 100
static

Definition at line 216 of file vfs_bio.c.

Referenced by flushbufqueues().

int flushingbufs
static

Definition at line 2218 of file vfs_bio.c.

int flushwithdeps = 0
static

Definition at line 2664 of file vfs_bio.c.

int getnewbufcalls
static

Definition at line 206 of file vfs_bio.c.

Referenced by getnewbuf().

int getnewbufrestarts
static

Definition at line 209 of file vfs_bio.c.

Referenced by getnewbuf(), and getnewbuf_scan().

long hibufspace

Definition at line 155 of file vfs_bio.c.

Referenced by bufinit(), getnewbuf_bufd_help(), and getnewbuf_scan().

int hidirtybuffers
static

Definition at line 191 of file vfs_bio.c.

Referenced by bdirty(), bdwrite(), buf_dirty_count_severe(), bufinit(), bwillwrite(), and flushbufqueues().

int hifreebuffers
static

Definition at line 203 of file vfs_bio.c.

Referenced by bufcountwakeup(), and bufinit().

long hirunningspace
static

Definition at line 170 of file vfs_bio.c.

Referenced by bufinit(), and waitrunningbufspace().

int inflight_transient_maps
long lobufspace
static

Definition at line 152 of file vfs_bio.c.

Referenced by bufinit(), and getnewbuf_scan().

int lodirtybuffers
static

Definition at line 188 of file vfs_bio.c.

Referenced by bdirty(), bdwrite(), brelse(), buf_daemon(), bufinit(), bundirty(), and flushbufqueues().

int lofreebuffers
static

Definition at line 200 of file vfs_bio.c.

Referenced by bufinit().

long lorunningspace
static

Definition at line 167 of file vfs_bio.c.

Referenced by bufinit(), and runningbufwakeup().

int mappingrestarts
static

Definition at line 212 of file vfs_bio.c.

Referenced by bp_unmapped_get_kva().

long maxbufmallocspace
static

Definition at line 149 of file vfs_bio.c.

Referenced by allocbuf(), and bufinit().

long maxbufspace
static

Definition at line 143 of file vfs_bio.c.

Referenced by bufinit().

struct mtx nblock
static
int needsbuffer
static
long notbufdflashes
static

Definition at line 219 of file vfs_bio.c.

Referenced by flushbufqueues().

int numdirtybuffers
static
int numfreebuffers
static

Definition at line 197 of file vfs_bio.c.

Referenced by bremfree(), bremfreel(), bufcountwakeup(), bufinit(), and getblk().

struct mtx rbreqlock
static

Definition at line 269 of file vfs_bio.c.

Referenced by bufinit(), runningbufwakeup(), and waitrunningbufspace().

int recursiveflushes
static

Definition at line 182 of file vfs_bio.c.

Referenced by bdwrite().

int runningbufreq
static

Definition at line 263 of file vfs_bio.c.

Referenced by runningbufwakeup(), and waitrunningbufspace().

long runningbufspace

Definition at line 127 of file vfs_bio.c.

Referenced by bufwrite(), runningbufwakeup(), and waitrunningbufspace().

caddr_t unmapped_buf

Definition at line 98 of file vfs_bio.c.

Referenced by bdata2bio(), bufinit(), cluster_rbuild(), cluster_wbuild_gb(), getnewbuf(), and vmapbuf().

long unmapped_bufspace
static

Definition at line 139 of file vfs_bio.c.

Referenced by bfreekva(), bp_unmapped_get_kva(), getnewbuf(), and setbufkva().

int vmiodirenable = TRUE

Definition at line 124 of file vfs_bio.c.