FreeBSD kernel kern code
vfs_bio.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/asan.h>
#include <sys/bio.h>
#include <sys/bitset.h>
#include <sys/boottrace.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/counter.h>
#include <sys/devicestat.h>
#include <sys/eventhandler.h>
#include <sys/fail.h>
#include <sys/ktr.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/racct.h>
#include <sys/refcount.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/syscallsubr.h>
#include <sys/vmem.h>
#include <sys/vmmeter.h>
#include <sys/vnode.h>
#include <sys/watchdog.h>
#include <geom/geom.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_kern.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/vm_pager.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <vm/swap_pager.h>
#include "opt_ddb.h"
Include dependency graph for vfs_bio.c:

Go to the source code of this file.

Data Structures

struct  bufqueue
 
struct  bufdomain
 

Macros

#define BQ_LOCKPTR(bq)   (&(bq)->bq_lock)
 
#define BQ_LOCK(bq)   mtx_lock(BQ_LOCKPTR((bq)))
 
#define BQ_UNLOCK(bq)   mtx_unlock(BQ_LOCKPTR((bq)))
 
#define BQ_ASSERT_LOCKED(bq)   mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED)
 
#define BD_LOCKPTR(bd)   (&(bd)->bd_cleanq->bq_lock)
 
#define BD_LOCK(bd)   mtx_lock(BD_LOCKPTR((bd)))
 
#define BD_UNLOCK(bd)   mtx_unlock(BD_LOCKPTR((bd)))
 
#define BD_ASSERT_LOCKED(bd)   mtx_assert(BD_LOCKPTR((bd)), MA_OWNED)
 
#define BD_RUN_LOCKPTR(bd)   (&(bd)->bd_run_lock)
 
#define BD_RUN_LOCK(bd)   mtx_lock(BD_RUN_LOCKPTR((bd)))
 
#define BD_RUN_UNLOCK(bd)   mtx_unlock(BD_RUN_LOCKPTR((bd)))
 
#define BD_DOMAIN(bd)   (bd - bdomain)
 
#define QUEUE_NONE   0 /* on no queue */
 
#define QUEUE_EMPTY   1 /* empty buffer headers */
 
#define QUEUE_DIRTY   2 /* B_DELWRI buffers */
 
#define QUEUE_CLEAN   3 /* non-B_DELWRI buffers */
 
#define QUEUE_SENTINEL   4 /* not an queue index, but mark for sentinel */
 
#define BUF_DOMAINS   8
 
#define TRANSIENT_DENOM   10
 
#define BUF_CHECK_MAPPED(bp)   do {} while (0)
 
#define BUF_CHECK_UNMAPPED(bp)   do {} while (0)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_BIOBUF, "biobuf", "BIO buffer")
 
struct bufqueue __aligned (CACHE_LINE_SIZE)
 
static struct bufnbufp (unsigned i)
 
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_clean_pages_dirty_buf (struct buf *bp)
 
static void vfs_setdirty_range (struct buf *bp)
 
static void vfs_vmio_invalidate (struct buf *bp)
 
static void vfs_vmio_truncate (struct buf *bp, int npages)
 
static void vfs_vmio_extend (struct buf *bp, int npages, int size)
 
static int vfs_bio_clcheck (struct vnode *vp, int size, daddr_t lblkno, daddr_t blkno)
 
static void breada (struct vnode *, daddr_t *, int *, int, struct ucred *, int, void(*)(struct buf *))
 
static int buf_flush (struct vnode *vp, struct bufdomain *, int)
 
static int flushbufqueues (struct vnode *, struct bufdomain *, int, int)
 
static void buf_daemon (void)
 
static __inline void bd_wakeup (void)
 
static int sysctl_runningspace (SYSCTL_HANDLER_ARGS)
 
static void bufkva_reclaim (vmem_t *, int)
 
static void bufkva_free (struct buf *)
 
static int buf_import (void *, void **, int, int, int)
 
static void buf_release (void *, void **, int)
 
static void maxbcachebuf_adjust (void)
 
static struct bufdomainbufdomain (struct buf *)
 
static void bq_remove (struct bufqueue *bq, struct buf *bp)
 
static void bq_insert (struct bufqueue *bq, struct buf *bp, bool unlock)
 
static int buf_recycle (struct bufdomain *, bool kva)
 
static void bq_init (struct bufqueue *bq, int qindex, int cpu, const char *lockname)
 
static void bd_init (struct bufdomain *bd)
 
static int bd_flushall (struct bufdomain *bd)
 
static int sysctl_bufdomain_long (SYSCTL_HANDLER_ARGS)
 
static int sysctl_bufdomain_int (SYSCTL_HANDLER_ARGS)
 
static int sysctl_bufspace (SYSCTL_HANDLER_ARGS)
 
 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_PROC (_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_bufspace, "L", "Physical memory used for buffers")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, bufkvaspace, CTLFLAG_RD, &bufkvaspace, "Kernel virtual memory used for buffers")
 
 SYSCTL_PROC (_vfs, OID_AUTO, maxbufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &maxbufspace, __offsetof(struct bufdomain, bd_maxbufspace), sysctl_bufdomain_long, "L", "Maximum allowed value of bufspace (including metadata)")
 
 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_PROC (_vfs, OID_AUTO, lobufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lobufspace, __offsetof(struct bufdomain, bd_lobufspace), sysctl_bufdomain_long, "L", "Minimum amount of buffers we want to have")
 
 SYSCTL_PROC (_vfs, OID_AUTO, hibufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hibufspace, __offsetof(struct bufdomain, bd_hibufspace), sysctl_bufdomain_long, "L", "Maximum allowed value of bufspace (excluding metadata)")
 
 SYSCTL_PROC (_vfs, OID_AUTO, bufspacethresh, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &bufspacethresh, __offsetof(struct bufdomain, bd_bufspacethresh), sysctl_bufdomain_long, "L", "Bufspace consumed before waking the daemon to free some")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, buffreekvacnt, CTLFLAG_RW, &buffreekvacnt, "Number of times we have freed the KVA space from some buffer")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, "Number of times we have had to repeat buffer allocation to defragment")
 
 SYSCTL_PROC (_vfs, OID_AUTO, lorunningspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &lorunningspace, 0, sysctl_runningspace, "L", "Minimum preferred space used for in-progress I/O")
 
 SYSCTL_PROC (_vfs, OID_AUTO, hirunningspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RW, &hirunningspace, 0, sysctl_runningspace, "L", "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|CTLFLAG_STATS, &altbufferflushes, 0, "Number of fsync flushes to limit dirty buffers")
 
 SYSCTL_INT (_vfs, OID_AUTO, recursiveflushes, CTLFLAG_RW|CTLFLAG_STATS, &recursiveflushes, 0, "Number of flushes skipped due to being recursive")
 
static int sysctl_numdirtybuffers (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_vfs, OID_AUTO, numdirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RD, NULL, 0, sysctl_numdirtybuffers, "I", "Number of buffers that are dirty (has unwritten changes) at the moment")
 
 SYSCTL_PROC (_vfs, OID_AUTO, lodirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lodirtybuffers, __offsetof(struct bufdomain, bd_lodirtybuffers), sysctl_bufdomain_int, "I", "How many buffers we want to have free before bufdaemon can sleep")
 
 SYSCTL_PROC (_vfs, OID_AUTO, hidirtybuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hidirtybuffers, __offsetof(struct bufdomain, bd_hidirtybuffers), sysctl_bufdomain_int, "I", "When the number of dirty buffers is considered severe")
 
 SYSCTL_PROC (_vfs, OID_AUTO, dirtybufthresh, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &dirtybufthresh, __offsetof(struct bufdomain, bd_dirtybufthresh), sysctl_bufdomain_int, "I", "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_PROC (_vfs, OID_AUTO, lofreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &lofreebuffers, __offsetof(struct bufdomain, bd_lofreebuffers), sysctl_bufdomain_int, "I", "Target number of free buffers")
 
 SYSCTL_PROC (_vfs, OID_AUTO, hifreebuffers, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &hifreebuffers, __offsetof(struct bufdomain, bd_hifreebuffers), sysctl_bufdomain_int, "I", "Threshold for clean buffer recycling")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, getnewbufcalls, CTLFLAG_RD, &getnewbufcalls, "Number of calls to getnewbuf")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RD, &getnewbufrestarts, "Number of times getnewbuf has had to restart a buffer acquisition")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, mappingrestarts, CTLFLAG_RD, &mappingrestarts, "Number of times getblk has had to restart a buffer mapping for " "unmapped buffer")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, numbufallocfails, CTLFLAG_RW, &numbufallocfails, "Number of times buffer allocations failed")
 
 SYSCTL_INT (_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0, "Amount of work to do in flushbufqueues when helping bufdaemon")
 
 SYSCTL_COUNTER_U64 (_vfs, OID_AUTO, notbufdflushes, CTLFLAG_RD, &notbufdflushes, "Number of dirty buffer flushes done by the bufdaemon helpers")
 
 SYSCTL_LONG (_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW|CTLFLAG_STATS, &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")
 
 SYSCTL_INT (_vfs, OID_AUTO, maxbcachebuf, CTLFLAG_RDTUN, &maxbcachebuf, 0, "Maximum size of a buffer cache block")
 
 BITSET_DEFINE (bufdomainset, BUF_DOMAINS)
 
static void bdirtywakeup (void)
 
static void bd_clear (struct bufdomain *bd)
 
static void bd_set (struct bufdomain *bd)
 
static void bdirtysub (struct buf *bp)
 
static void bdirtyadd (struct buf *bp)
 
static void bufspace_daemon_wakeup (struct bufdomain *bd)
 
static void bufspace_adjust (struct buf *bp, int bufsize)
 
static int bufspace_reserve (struct bufdomain *bd, int size, bool metadata)
 
static void bufspace_release (struct bufdomain *bd, int size)
 
static void bufspace_wait (struct bufdomain *bd, struct vnode *vp, int gbflags, int slpflag, int slptimeo)
 
static void bufspace_daemon_shutdown (void *arg, int howto __unused)
 
static void bufspace_daemon (void *arg)
 
static void bufmallocadjust (struct buf *bp, int bufsize)
 
static void runningwakeup (void)
 
void runningbufwakeup (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)
 
void bd_speedup (void)
 
caddr_t kern_vfs_bio_buffer_alloc (caddr_t v, long physmem_est)
 
void bufinit (void)
 
static int isbufbusy (struct buf *bp)
 
void bufshutdown (int show_busybufs)
 
static void bpmap_qenter (struct buf *bp)
 
static struct bufqueuebufqueue (struct buf *bp)
 
static struct bufqueuebufqueue_acquire (struct buf *bp)
 
static void binsfree (struct buf *bp, int qindex)
 
static void buf_free (struct buf *bp)
 
static struct bufbuf_alloc (struct bufdomain *bd)
 
void bremfree (struct buf *bp)
 
void bremfreef (struct buf *bp)
 
static void bd_flush (struct bufdomain *bd, struct bufqueue *bq)
 
static int bufkva_alloc (struct buf *bp, int maxsize, int gbflags)
 
int breadn_flags (struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, daddr_t *rablkno, int *rabsize, int cnt, struct ucred *cred, int flags, void(*ckhashfunc)(struct buf *), 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)
 
void brelse (struct buf *bp)
 
void bqrelse (struct buf *bp)
 
static void vfs_vmio_iodone (struct buf *bp)
 
int vfs_bio_awrite (struct buf *bp)
 
static int getnewbuf_kva (struct buf *bp, int gbflags, int maxsize)
 
static struct bufgetnewbuf (struct vnode *vp, int slpflag, int slptimeo, int maxsize, int gbflags)
 
 SYSINIT (bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp)
 
static void buf_daemon_shutdown (void *arg __unused, int howto __unused)
 
 SYSCTL_INT (_vfs, OID_AUTO, flushwithdeps, CTLFLAG_RW|CTLFLAG_STATS, &flushwithdeps, 0, "Number of buffers flushed with dependencies that require rollbacks")
 
struct bufincore (struct bufobj *bo, daddr_t blkno)
 
bool inmem (struct vnode *vp, 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)
 
int getblkx (struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int slpflag, int slptimeo, int flags, struct buf **bpp)
 
struct bufgeteblk (int size, int flags)
 
static void vfs_nonvmio_truncate (struct buf *bp, int newbsize)
 
static void vfs_nonvmio_extend (struct buf *bp, int newbsize)
 
int allocbuf (struct buf *bp, int size)
 
void biodone (struct bio *bp)
 
int biowait (struct bio *bp, const char *wmesg)
 
void biofinish (struct bio *bp, struct devstat *stat, int error)
 
int bufwait (struct buf *bp)
 
void bufdone (struct buf *bp)
 
void vfs_unbusy_pages (struct buf *bp)
 
void vfs_busy_pages_acquire (struct buf *bp)
 
void vfs_busy_pages_release (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)
 
static void b_io_dismiss (struct buf *bp, int ioflag, bool release)
 
void vfs_bio_brelse (struct buf *bp, int ioflag)
 
void vfs_bio_set_flags (struct buf *bp, int ioflag)
 
int vmapbuf (struct buf *bp, void *uaddr, size_t len, 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_init (struct bufobj *bo, void *private)
 
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 bdata2bio (struct buf *bp, struct bio *bip)
 
 SYSCTL_INT (_vfs, OID_AUTO, buf_pager_relbuf, CTLFLAG_RWTUN, &buf_pager_relbuf, 0, "Make buffer pager release buffers after reading")
 
int vfs_bio_getpages (struct vnode *vp, vm_page_t *ma, int count, int *rbehind, int *rahead, vbg_get_lblkno_t get_lblkno, vbg_get_blksize_t get_blksize)
 

Variables

struct bio_ops bioops
 
struct buf_ops buf_ops_bio
 
struct mtx_padalign bq_lock
 
struct bufqueue bd_subq [MAXCPU+1]
 
struct bufqueue bd_dirtyq
 
struct bufqueuebd_cleanq
 
struct mtx_padalign bd_run_lock
 
long bd_maxbufspace
 
long bd_hibufspace
 
long bd_lobufspace
 
long bd_bufspacethresh
 
int bd_hifreebuffers
 
int bd_lofreebuffers
 
int bd_hidirtybuffers
 
int bd_lodirtybuffers
 
int bd_dirtybufthresh
 
int bd_lim
 
int bd_wanted
 
bool bd_shutdown
 
static char * buf
 
caddr_t __read_mostly unmapped_buf
 
struct proc * bufdaemonproc
 
int vmiodirenable = TRUE
 
long runningbufspace
 
static counter_u64_t bufkvaspace
 
static long maxbufspace
 
static long bufmallocspace
 
static long maxbufmallocspace
 
static long lobufspace
 
long hibufspace
 
long bufspacethresh
 
static counter_u64_t buffreekvacnt
 
static counter_u64_t bufdefragcnt
 
static long lorunningspace
 
static long hirunningspace
 
int dirtybufferflushes
 
int bdwriteskip
 
int altbufferflushes
 
static int recursiveflushes
 
static int lodirtybuffers
 
static int hidirtybuffers
 
int dirtybufthresh
 
static int numfreebuffers
 
static int lofreebuffers
 
static int hifreebuffers
 
static counter_u64_t getnewbufcalls
 
static counter_u64_t getnewbufrestarts
 
static counter_u64_t mappingrestarts
 
static counter_u64_t numbufallocfails
 
static int flushbufqtarget = 100
 
static counter_u64_t notbufdflushes
 
static long barrierwrites
 
int maxbcachebuf = MAXBCACHEBUF
 
static struct mtx_padalign __exclusive_cache_line bdlock
 
static struct mtx_padalign __exclusive_cache_line rbreqlock
 
static struct mtx_padalign __exclusive_cache_line bdirtylock
 
static int bd_request
 
static int bd_speedupreq
 
static int runningbufreq
 
static int bdirtywait
 
struct bufdomainset bdlodirty
 
struct bufdomainset bdhidirty
 
static int __read_mostly buf_domains
 
struct bufdomain __exclusive_cache_line bdomain [BUF_DOMAINS]
 
struct bufqueue __exclusive_cache_line bqempty
 
uma_zone_t buf_zone
 
static const char buf_wmesg [] = "bufwait"
 
static struct kproc_desc buf_kp
 
static int flushwithdeps = 0
 
int inflight_transient_maps
 
static struct bio_queue nondump_bios
 
static int buf_pager_relbuf = 0
 

Macro Definition Documentation

◆ BD_ASSERT_LOCKED

#define BD_ASSERT_LOCKED (   bd)    mtx_assert(BD_LOCKPTR((bd)), MA_OWNED)

Definition at line 147 of file vfs_bio.c.

◆ BD_DOMAIN

#define BD_DOMAIN (   bd)    (bd - bdomain)

Definition at line 151 of file vfs_bio.c.

◆ BD_LOCK

#define BD_LOCK (   bd)    mtx_lock(BD_LOCKPTR((bd)))

Definition at line 145 of file vfs_bio.c.

◆ BD_LOCKPTR

#define BD_LOCKPTR (   bd)    (&(bd)->bd_cleanq->bq_lock)

Definition at line 144 of file vfs_bio.c.

◆ BD_RUN_LOCK

#define BD_RUN_LOCK (   bd)    mtx_lock(BD_RUN_LOCKPTR((bd)))

Definition at line 149 of file vfs_bio.c.

◆ BD_RUN_LOCKPTR

#define BD_RUN_LOCKPTR (   bd)    (&(bd)->bd_run_lock)

Definition at line 148 of file vfs_bio.c.

◆ BD_RUN_UNLOCK

#define BD_RUN_UNLOCK (   bd)    mtx_unlock(BD_RUN_LOCKPTR((bd)))

Definition at line 150 of file vfs_bio.c.

◆ BD_UNLOCK

#define BD_UNLOCK (   bd)    mtx_unlock(BD_LOCKPTR((bd)))

Definition at line 146 of file vfs_bio.c.

◆ BQ_ASSERT_LOCKED

#define BQ_ASSERT_LOCKED (   bq)    mtx_assert(BQ_LOCKPTR((bq)), MA_OWNED)

Definition at line 117 of file vfs_bio.c.

◆ BQ_LOCK

#define BQ_LOCK (   bq)    mtx_lock(BQ_LOCKPTR((bq)))

Definition at line 115 of file vfs_bio.c.

◆ BQ_LOCKPTR

#define BQ_LOCKPTR (   bq)    (&(bq)->bq_lock)

Definition at line 114 of file vfs_bio.c.

◆ BQ_UNLOCK

#define BQ_UNLOCK (   bq)    mtx_unlock(BQ_LOCKPTR((bq)))

Definition at line 116 of file vfs_bio.c.

◆ BUF_CHECK_MAPPED

#define BUF_CHECK_MAPPED (   bp)    do {} while (0)

Definition at line 1356 of file vfs_bio.c.

◆ BUF_CHECK_UNMAPPED

#define BUF_CHECK_UNMAPPED (   bp)    do {} while (0)

Definition at line 1357 of file vfs_bio.c.

◆ BUF_DOMAINS

#define BUF_DOMAINS   8

Definition at line 387 of file vfs_bio.c.

◆ QUEUE_CLEAN

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

Definition at line 383 of file vfs_bio.c.

◆ QUEUE_DIRTY

#define QUEUE_DIRTY   2 /* B_DELWRI buffers */

Definition at line 382 of file vfs_bio.c.

◆ QUEUE_EMPTY

#define QUEUE_EMPTY   1 /* empty buffer headers */

Definition at line 381 of file vfs_bio.c.

◆ QUEUE_NONE

#define QUEUE_NONE   0 /* on no queue */

Definition at line 380 of file vfs_bio.c.

◆ QUEUE_SENTINEL

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

Definition at line 384 of file vfs_bio.c.

◆ TRANSIENT_DENOM

#define TRANSIENT_DENOM   10

Definition at line 1043 of file vfs_bio.c.

Function Documentation

◆ __aligned()

struct bufqueue __aligned ( CACHE_LINE_SIZE  )

References bufbdflush(), bufstrategy(), bufsync(), and bufwrite().

Here is the call graph for this function:

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ allocbuf()

int allocbuf ( struct buf bp,
int  size 
)

Definition at line 4359 of file vfs_bio.c.

References bufspace_adjust(), panic(), vfs_nonvmio_extend(), vfs_nonvmio_truncate(), vfs_vmio_extend(), and vfs_vmio_truncate().

Referenced by brelse(), getblkx(), and geteblk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ b_io_dismiss()

static void b_io_dismiss ( struct buf bp,
int  ioflag,
bool  release 
)
static

Definition at line 4925 of file vfs_bio.c.

References bqrelse(), and brelse().

Referenced by vfs_bio_brelse(), and vfs_bio_set_flags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ babarrierwrite()

void babarrierwrite ( struct buf bp)

Definition at line 2597 of file vfs_bio.c.

◆ bawrite()

void bawrite ( struct buf bp)

Definition at line 2580 of file vfs_bio.c.

Referenced by bufbdflush(), cluster_wbuild(), cluster_write(), vn_fsync_buf(), and vtruncbuf().

Here is the caller graph for this function:

◆ bbarrierwrite()

int bbarrierwrite ( struct buf bp)

Definition at line 2614 of file vfs_bio.c.

◆ bd_clear()

static void bd_clear ( struct bufdomain bd)
static

Definition at line 539 of file vfs_bio.c.

References BD_DOMAIN, bufdomain::bd_hidirtybuffers, bufdomain::bd_lodirtybuffers, bdhidirty, bdirtylock, bdlodirty, and BUF_DOMAINS.

Referenced by bdirtysub().

Here is the caller graph for this function:

◆ bd_flush()

static void bd_flush ( struct bufdomain bd,
struct bufqueue bq 
)
static

Definition at line 1953 of file vfs_bio.c.

References bufdomain::bd_cleanq, BD_LOCK, BD_UNLOCK, bufdomain::bd_wanted, BQ_ASSERT_LOCKED, buf, and wakeup().

Referenced by bd_flushall(), and bq_insert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bd_flushall()

static int bd_flushall ( struct bufdomain bd)
static

Definition at line 1978 of file vfs_bio.c.

References bd_flush(), bufdomain::bd_lim, bufdomain::bd_subq, BQ_LOCK, BQ_UNLOCK, and mp_maxid.

Referenced by bufspace_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bd_init()

static void bd_init ( struct bufdomain bd)
static

Definition at line 1910 of file vfs_bio.c.

References bufdomain::bd_cleanq, bufdomain::bd_dirtyq, bufdomain::bd_run_lock, bufdomain::bd_subq, bq_init(), mp_maxid, QUEUE_CLEAN, and QUEUE_DIRTY.

Referenced by bufinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bd_set()

static void bd_set ( struct bufdomain bd)
static

Definition at line 557 of file vfs_bio.c.

References BD_DOMAIN, bufdomain::bd_hidirtybuffers, bufdomain::bd_lodirtybuffers, bdhidirty, bdirtylock, bdlodirty, and BUF_DOMAINS.

Referenced by bdirtyadd().

Here is the caller graph for this function:

◆ bd_speedup()

void bd_speedup ( void  )

Definition at line 1025 of file vfs_bio.c.

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

Referenced by bufspace_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bd_wakeup()

static void bd_wakeup ( void  )
static

Definition at line 987 of file vfs_bio.c.

References bd_request, bdlock, and wakeup().

Referenced by bdirtyadd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bdata2bio()

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

Definition at line 5192 of file vfs_bio.c.

References unmapped_buf.

◆ bdirty()

void bdirty ( struct buf bp)

Definition at line 2521 of file vfs_bio.c.

References bdirtyadd(), 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:

◆ bdirtyadd()

static void bdirtyadd ( struct buf bp)
static

Definition at line 595 of file vfs_bio.c.

References bufdomain::bd_hidirtybuffers, bufdomain::bd_lodirtybuffers, bd_set(), bd_wakeup(), and bufdomain().

Referenced by bdirty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bdirtysub()

static void bdirtysub ( struct buf bp)
static

Definition at line 575 of file vfs_bio.c.

References bd_clear(), bufdomain::bd_hidirtybuffers, bufdomain::bd_lodirtybuffers, bdirtywakeup(), and bufdomain().

Referenced by brelse(), and bundirty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bdirtywakeup()

static void bdirtywakeup ( void  )
static

Definition at line 522 of file vfs_bio.c.

References bdirtylock, bdirtywait, and wakeup().

Referenced by bdirtysub(), and buf_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bdone()

void bdone ( struct buf bp)

Definition at line 5077 of file vfs_bio.c.

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

Referenced by bufdone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bdwrite()

void bdwrite ( struct buf bp)

Definition at line 2428 of file vfs_bio.c.

References bdirty(), bqrelse(), brelse(), recursiveflushes, and vfs_clean_pages_dirty_buf().

Referenced by cluster_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ binsfree()

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

Definition at line 1577 of file vfs_bio.c.

References bufdomain::bd_cleanq, bufdomain::bd_dirtyq, bufdomain::bd_lim, bufdomain::bd_subq, bq_insert(), bq_remove(), BQ_UNLOCK, bufdomain(), bufqueue_acquire(), QUEUE_CLEAN, and QUEUE_DIRTY.

Referenced by bqrelse(), and brelse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ biodone()

void biodone ( struct bio *  bp)

Definition at line 4412 of file vfs_bio.c.

References biodone(), dumping, inflight_transient_maps, mtx, mtx_pool_find(), mtxpool_sleep, nondump_bios, start, unmapped_buf, vmem_free(), and wakeup().

Referenced by biodone(), biofinish(), and bufdone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ biofinish()

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

Definition at line 4476 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:

◆ biowait()

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

Definition at line 4459 of file vfs_bio.c.

References mtx, mtx_pool_find(), and mtxpool_sleep.

Referenced by physio().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BITSET_DEFINE()

BITSET_DEFINE ( bufdomainset  ,
BUF_DOMAINS   
)

◆ bp_unmapped_get_kva()

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

Definition at line 3841 of file vfs_bio.c.

References bpmap_qenter(), BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, bufdomain(), bufkva_alloc(), bufspace_wait(), mappingrestarts, panic(), unmapped_buf, and vn_isdisk().

Referenced by getblkx().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bpmap_qenter()

static void bpmap_qenter ( struct buf bp)
static

Definition at line 1501 of file vfs_bio.c.

References BUF_CHECK_MAPPED.

Referenced by bp_unmapped_get_kva(), and vfs_vmio_extend().

Here is the caller graph for this function:

◆ bq_init()

static void bq_init ( struct bufqueue bq,
int  qindex,
int  cpu,
const char *  lockname 
)
static

Definition at line 1899 of file vfs_bio.c.

References bufqueue::bq_lock.

Referenced by bd_init(), and bufinit().

Here is the caller graph for this function:

◆ bq_insert()

static void bq_insert ( struct bufqueue bq,
struct buf bp,
bool  unlock 
)
static

Definition at line 2001 of file vfs_bio.c.

References bufdomain::bd_cleanq, bd_flush(), bufdomain::bd_lim, bufdomain::bd_wanted, BQ_LOCK, BQ_UNLOCK, bufdomain(), panic(), QUEUE_CLEAN, and QUEUE_NONE.

Referenced by binsfree(), and bufinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bq_remove()

static void bq_remove ( struct bufqueue bq,
struct buf bp 
)
static

Definition at line 1930 of file vfs_bio.c.

References BQ_ASSERT_LOCKED, bufqueue(), QUEUE_EMPTY, and QUEUE_NONE.

Referenced by binsfree(), bremfreef(), buf_import(), and buf_recycle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bqrelse()

void bqrelse ( struct buf bp)

Definition at line 2872 of file vfs_bio.c.

References binsfree(), brelse(), bremfreef(), panic(), QUEUE_CLEAN, QUEUE_DIRTY, and QUEUE_NONE.

Referenced by b_io_dismiss(), bdwrite(), brelse(), buf_recycle(), bufdone(), cluster_rbuild(), cluster_read(), cluster_wbuild(), and vfs_bio_getpages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ breada()

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

Definition at line 2143 of file vfs_bio.c.

References brelse(), buf, crhold(), flags, 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:

◆ breadn_flags()

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

Definition at line 2203 of file vfs_bio.c.

References breada(), brelse(), buf, bufwait(), crhold(), flags, getblkx(), and vfs_busy_pages().

Here is the call graph for this function:

◆ brelse()

◆ bremfree()

void bremfree ( struct buf bp)

Definition at line 1869 of file vfs_bio.c.

References QUEUE_NONE.

Referenced by bnoreuselist(), bufbdflush(), cluster_wbuild(), flushbuflist(), flushbufqueues(), getblkx(), v_inval_buf_range_locked(), vfs_bio_awrite(), vn_fsync_buf(), and vtruncbuf().

Here is the caller graph for this function:

◆ bremfreef()

void bremfreef ( struct buf bp)

Definition at line 1889 of file vfs_bio.c.

References bq_remove(), BQ_UNLOCK, and bufqueue_acquire().

Referenced by bqrelse(), buf_free(), and flushbufqueues().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_alloc()

static struct buf * buf_alloc ( struct bufdomain bd)
static

Definition at line 1699 of file vfs_bio.c.

References BD_DOMAIN, bufdomain::bd_lofreebuffers, buf, buf_zone, bufspace_daemon_wakeup(), numbufallocfails, and unmapped_buf.

Referenced by getnewbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_daemon()

◆ buf_daemon_shutdown()

static void buf_daemon_shutdown ( void *arg  __unused,
int howto  __unused 
)
static

Definition at line 3415 of file vfs_bio.c.

References bd_request, bd_shutdown, bdlock, hz, printf(), and wakeup().

Referenced by buf_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_dirty_count_severe()

int buf_dirty_count_severe ( void  )

Definition at line 2649 of file vfs_bio.c.

References bdhidirty, and BUF_DOMAINS.

Referenced by bwillwrite().

Here is the caller graph for this function:

◆ buf_flush()

static int buf_flush ( struct vnode *  vp,
struct bufdomain bd,
int  target 
)
static

Definition at line 3396 of file vfs_bio.c.

References flushbufqueues().

Referenced by buf_daemon(), and bufspace_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_free()

static void buf_free ( struct buf bp)
static

Definition at line 1617 of file vfs_bio.c.

References bremfreef(), buf_zone, bufdomain(), bufkva_free(), crfree(), and panic().

Referenced by brelse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_import()

static int buf_import ( void *  arg,
void **  store,
int  cnt,
int  domain,
int  flags 
)
static

Definition at line 1650 of file vfs_bio.c.

References BQ_LOCK, bq_remove(), BQ_UNLOCK, bqempty, and buf.

Referenced by bufinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_recycle()

static int buf_recycle ( struct bufdomain bd,
bool  kva 
)
static

Definition at line 1774 of file vfs_bio.c.

References bufdomain::bd_cleanq, BD_DOMAIN, BD_LOCKPTR, bufdomain::bd_wanted, BQ_LOCK, BQ_LOCKPTR, bq_remove(), BQ_UNLOCK, bqrelse(), brelse(), buf, bufdefragcnt, and QUEUE_CLEAN.

Referenced by bufkva_reclaim(), bufspace_daemon(), and getnewbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buf_release()

static void buf_release ( void *  arg,
void **  store,
int  cnt 
)
static

Definition at line 1674 of file vfs_bio.c.

References BQ_LOCK, BQ_UNLOCK, bqempty, and buf.

Referenced by bufinit().

Here is the caller graph for this function:

◆ bufbdflush()

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

Definition at line 2376 of file vfs_bio.c.

References altbufferflushes, bawrite(), bufdomain::bd_dirtybufthresh, bdomain, bremfree(), buf, dirtybufferflushes, panic(), and vfs_bio_awrite().

Referenced by __aligned().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufdomain()

static struct bufdomain * bufdomain ( struct buf bp)
inlinestatic

Definition at line 1517 of file vfs_bio.c.

References bdomain.

Referenced by bdirtyadd(), bdirtysub(), binsfree(), bp_unmapped_get_kva(), bq_insert(), buf_free(), bufqueue(), bufspace_adjust(), getblkx(), and geteblk().

Here is the caller graph for this function:

◆ bufdone()

void bufdone ( struct buf bp)

Definition at line 4542 of file vfs_bio.c.

References bdone(), biodone(), bqrelse(), brelse(), buf, bufobj_wdrop(), runningbufwakeup(), and vfs_vmio_iodone().

Referenced by cluster_callback(), and vop_nostrategy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufinit()

◆ bufkva_alloc()

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

Definition at line 2078 of file vfs_bio.c.

References addr, BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, bufkva_free(), bufkvaspace, maxbcachebuf, unmapped_buf, and vmem_alloc().

Referenced by bp_unmapped_get_kva(), and getnewbuf_kva().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufkva_free()

static void bufkva_free ( struct buf bp)
static

Definition at line 2049 of file vfs_bio.c.

References BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, buffreekvacnt, bufkvaspace, unmapped_buf, and vmem_free().

Referenced by buf_free(), and bufkva_alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufkva_reclaim()

static void bufkva_reclaim ( vmem_t *  vmem,
int  flags 
)
static

Definition at line 2120 of file vfs_bio.c.

References bdomain, buf_domains, and buf_recycle().

Referenced by bufinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufmallocadjust()

static void bufmallocadjust ( struct buf bp,
int  bufsize 
)
static

Definition at line 877 of file vfs_bio.c.

References bufmallocspace.

Referenced by vfs_nonvmio_extend(), and vfs_nonvmio_truncate().

Here is the caller graph for this function:

◆ bufobj_init()

void bufobj_init ( struct bufobj *  bo,
void *  private 
)

Definition at line 5125 of file vfs_bio.c.

References buf_domains.

Referenced by vnode_init().

Here is the caller graph for this function:

◆ bufobj_wdrop()

void bufobj_wdrop ( struct bufobj *  bo)

Definition at line 5157 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:

◆ bufobj_wref()

void bufobj_wref ( struct bufobj *  bo)

Definition at line 5147 of file vfs_bio.c.

Referenced by bufwrite(), and cluster_wbuild().

Here is the caller graph for this function:

◆ bufobj_wrefl()

void bufobj_wrefl ( struct bufobj *  bo)

Definition at line 5138 of file vfs_bio.c.

◆ bufobj_wwait()

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

Definition at line 5171 of file vfs_bio.c.

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

Here is the caller graph for this function:

◆ bufqueue()

static struct bufqueue * bufqueue ( struct buf bp)
static

Definition at line 1524 of file vfs_bio.c.

References bd_dirtyq, bd_subq, bqempty, bufdomain(), panic(), QUEUE_CLEAN, QUEUE_DIRTY, QUEUE_EMPTY, QUEUE_NONE, and QUEUE_SENTINEL.

Referenced by bq_remove(), and bufqueue_acquire().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufqueue_acquire()

static struct bufqueue * bufqueue_acquire ( struct buf bp)
static

Definition at line 1548 of file vfs_bio.c.

References BQ_LOCK, BQ_UNLOCK, and bufqueue().

Referenced by binsfree(), and bremfreef().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufshutdown()

void bufshutdown ( int  show_busybufs)

Definition at line 1373 of file vfs_bio.c.

References buf, isbufbusy(), kern_sync(), mi_switch(), mountlist, nbuf, nbufp(), printf(), show_busybufs, vfs_unmountall(), and vn_printf().

Referenced by kern_reboot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufspace_adjust()

static void bufspace_adjust ( struct buf bp,
int  bufsize 
)
static

Definition at line 639 of file vfs_bio.c.

References bd_bufspacethresh, bufdomain::bd_bufspacethresh, bufdomain(), and bufspace_daemon_wakeup().

Referenced by allocbuf(), vfs_nonvmio_extend(), and vfs_nonvmio_truncate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufspace_daemon()

static void bufspace_daemon ( void *  arg)
static

◆ bufspace_daemon_shutdown()

static void bufspace_daemon_shutdown ( void *  arg,
int howto  __unused 
)
static

Definition at line 763 of file vfs_bio.c.

References BD_RUN_LOCK, BD_RUN_LOCKPTR, BD_RUN_UNLOCK, bufdomain::bd_shutdown, hz, printf(), and wakeup().

Referenced by bufspace_daemon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufspace_daemon_wakeup()

static void bufspace_daemon_wakeup ( struct bufdomain bd)
static

Definition at line 618 of file vfs_bio.c.

References BD_RUN_LOCK, BD_RUN_UNLOCK, and wakeup().

Referenced by buf_alloc(), bufspace_adjust(), and bufspace_reserve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufspace_release()

static void bufspace_release ( struct bufdomain bd,
int  size 
)
static

Definition at line 697 of file vfs_bio.c.

Referenced by getblkx(), geteblk(), and getnewbuf().

Here is the caller graph for this function:

◆ bufspace_reserve()

static int bufspace_reserve ( struct bufdomain bd,
int  size,
bool  metadata 
)
static

Definition at line 668 of file vfs_bio.c.

References bd_bufspacethresh, bufdomain::bd_bufspacethresh, bufdomain::bd_hibufspace, bufdomain::bd_maxbufspace, and bufspace_daemon_wakeup().

Referenced by getnewbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufspace_wait()

static void bufspace_wait ( struct bufdomain bd,
struct vnode *  vp,
int  gbflags,
int  slpflag,
int  slptimeo 
)
static

Definition at line 711 of file vfs_bio.c.

References BD_LOCK, BD_LOCKPTR, BD_UNLOCK, bufdomain::bd_wanted, buf_flush(), and flushbufqtarget.

Referenced by bp_unmapped_get_kva(), and getnewbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufstrategy()

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

Definition at line 5108 of file vfs_bio.c.

Referenced by __aligned().

Here is the caller graph for this function:

◆ bufsync()

int bufsync ( struct bufobj *  bo,
int  waitfor 
)

Definition at line 5101 of file vfs_bio.c.

Referenced by __aligned().

Here is the caller graph for this function:

◆ bufwait()

int bufwait ( struct buf bp)

Definition at line 4505 of file vfs_bio.c.

References bwait().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufwrite()

int bufwrite ( struct buf bp)

Definition at line 2286 of file vfs_bio.c.

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

Referenced by __aligned().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bundirty()

void bundirty ( struct buf bp)

Definition at line 2551 of file vfs_bio.c.

References bdirtysub(), QUEUE_NONE, and reassignbuf().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bwait()

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

Definition at line 5089 of file vfs_bio.c.

References mtx, mtx_pool_find(), and mtxpool_sleep.

Referenced by bufwait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bwillwrite()

void bwillwrite ( void  )

◆ flushbufqueues()

static int flushbufqueues ( struct vnode *  lvp,
struct bufdomain bd,
int  target,
int  flushdeps 
)
static

Definition at line 3545 of file vfs_bio.c.

References bufdomain::bd_dirtyq, BQ_LOCK, BQ_UNLOCK, brelse(), bremfree(), bremfreef(), buf, bufdaemonproc, flushwithdeps, free(), hirunningspace, malloc(), maybe_yield(), notbufdflushes, QUEUE_SENTINEL, runningbufspace, vfs_bio_awrite(), vn_finished_write(), vn_start_write(), and waitrunningbufspace().

Referenced by buf_flush().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblk()

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

Definition at line 3896 of file vfs_bio.c.

References buf, flags, and getblkx().

Referenced by breada(), cluster_rbuild(), and cluster_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getblkx()

int getblkx ( struct vnode *  vp,
daddr_t  blkno,
daddr_t  dblkno,
int  size,
int  slpflag,
int  slptimeo,
int  flags,
struct buf **  bpp 
)

Definition at line 3952 of file vfs_bio.c.

References allocbuf(), bgetvp(), bp_unmapped_get_kva(), brelse(), bremfree(), buf, BUF_CHECK_MAPPED, bufdomain(), bufspace_release(), flags, gbincore(), gbincore_unlocked(), getnewbuf(), kern_yield(), maxbcachebuf, panic(), QUEUE_NONE, and vn_isdisk().

Referenced by breadn_flags(), cluster_read(), and getblk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ geteblk()

struct buf * geteblk ( int  size,
int  flags 
)

Definition at line 4253 of file vfs_bio.c.

References allocbuf(), buf, bufdomain(), bufspace_release(), flags, and getnewbuf().

Here is the call graph for this function:

◆ getnewbuf()

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

Definition at line 3330 of file vfs_bio.c.

References bdomain, brelse(), buf, buf_alloc(), buf_recycle(), bufspace_release(), bufspace_reserve(), bufspace_wait(), getnewbuf_kva(), getnewbufcalls, and getnewbufrestarts.

Referenced by getblkx(), and geteblk().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getnewbuf_kva()

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

Definition at line 3297 of file vfs_bio.c.

References bufkva_alloc().

Referenced by getnewbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incore()

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

Definition at line 3682 of file vfs_bio.c.

References gbincore_unlocked().

Referenced by inmem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inmem()

bool inmem ( struct vnode *  vp,
daddr_t  blkno 
)

Definition at line 3693 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:

◆ isbufbusy()

static int isbufbusy ( struct buf bp)
static

Definition at line 1361 of file vfs_bio.c.

Referenced by bufshutdown().

Here is the caller graph for this function:

◆ kern_vfs_bio_buffer_alloc()

caddr_t kern_vfs_bio_buffer_alloc ( caddr_t  v,
long  physmem_est 
)

Definition at line 1053 of file vfs_bio.c.

References bio_transient_maxcnt, buf, maxbcache, maxbcachebuf, maxbcachebuf_adjust(), maxphys, nbuf, nswbuf, printf(), and TRANSIENT_DENOM.

Here is the call graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_BIOBUF  ,
"biobuf"  ,
"BIO buffer"   
)
static

◆ maxbcachebuf_adjust()

static void maxbcachebuf_adjust ( void  )
static

Definition at line 1002 of file vfs_bio.c.

References bootverbose, maxbcachebuf, maxphys, and printf().

Referenced by kern_vfs_bio_buffer_alloc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nbufp()

static struct buf * nbufp ( unsigned  i)
static

Definition at line 155 of file vfs_bio.c.

References buf, and maxbcachebuf.

Referenced by bufinit(), and bufshutdown().

Here is the caller graph for this function:

◆ runningbufwakeup()

void runningbufwakeup ( struct buf bp)

Definition at line 915 of file vfs_bio.c.

References lorunningspace, runningbufspace, and runningwakeup().

Referenced by bufdone(), and vfs_unbusy_pages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runningwakeup()

static void runningwakeup ( void  )
static

Definition at line 898 of file vfs_bio.c.

References rbreqlock, runningbufreq, and wakeup().

Referenced by buf_daemon(), and runningbufwakeup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sysctl_bufdomain_int()

static int sysctl_bufdomain_int ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 433 of file vfs_bio.c.

References bdomain, buf_domains, sysctl_handle_int(), and value.

Here is the call graph for this function:

◆ sysctl_bufdomain_long()

static int sysctl_bufdomain_long ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 452 of file vfs_bio.c.

References bdomain, buf_domains, sysctl_handle_long(), and value.

Here is the call graph for this function:

◆ sysctl_bufspace()

static int sysctl_bufspace ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 492 of file vfs_bio.c.

References bdomain, buf_domains, and sysctl_handle_long().

Here is the call graph for this function:

◆ SYSCTL_COUNTER_U64() [1/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
bufdefragcnt  ,
CTLFLAG_RW  ,
bufdefragcnt,
"Number of times we have had to repeat buffer allocation to defragment"   
)

◆ SYSCTL_COUNTER_U64() [2/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
buffreekvacnt  ,
CTLFLAG_RW  ,
buffreekvacnt,
"Number of times we have freed the KVA space from some buffer"   
)

◆ SYSCTL_COUNTER_U64() [3/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
bufkvaspace  ,
CTLFLAG_RD  ,
bufkvaspace,
"Kernel virtual memory used for buffers"   
)

◆ SYSCTL_COUNTER_U64() [4/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
getnewbufcalls  ,
CTLFLAG_RD  ,
getnewbufcalls,
"Number of calls to getnewbuf  
)

◆ SYSCTL_COUNTER_U64() [5/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
getnewbufrestarts  ,
CTLFLAG_RD  ,
getnewbufrestarts,
"Number of times getnewbuf has had to restart a buffer acquisition"   
)

◆ SYSCTL_COUNTER_U64() [6/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
mappingrestarts  ,
CTLFLAG_RD  ,
mappingrestarts,
"Number of times getblk has had to restart a buffer mapping for " "unmapped buffer"   
)

◆ SYSCTL_COUNTER_U64() [7/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
notbufdflushes  ,
CTLFLAG_RD  ,
notbufdflushes,
"Number of dirty buffer flushes done by the bufdaemon helpers"   
)

◆ SYSCTL_COUNTER_U64() [8/8]

SYSCTL_COUNTER_U64 ( _vfs  ,
OID_AUTO  ,
numbufallocfails  ,
CTLFLAG_RW  ,
numbufallocfails,
"Number of times buffer allocations failed"   
)

◆ SYSCTL_INT() [1/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
altbufferflushes  ,
CTLFLAG_RW|  CTLFLAG_STATS,
altbufferflushes,
,
"Number of fsync flushes to limit dirty buffers"   
)

◆ SYSCTL_INT() [2/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
bdwriteskip  ,
CTLFLAG_RW  ,
bdwriteskip,
,
"Number of buffers supplied to bdwrite with snapshot deadlock risk"   
)

◆ SYSCTL_INT() [3/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
buf_pager_relbuf  ,
CTLFLAG_RWTUN  ,
buf_pager_relbuf,
,
"Make buffer pager release buffers after reading"   
)

◆ SYSCTL_INT() [4/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
dirtybufferflushes  ,
CTLFLAG_RW  ,
dirtybufferflushes,
,
"Number of bdwrite to bawrite conversions to limit dirty buffers"   
)

◆ SYSCTL_INT() [5/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
flushbufqtarget  ,
CTLFLAG_RW  ,
flushbufqtarget,
,
"Amount of work to do in flushbufqueues when helping bufdaemon"   
)

◆ SYSCTL_INT() [6/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
flushwithdeps  ,
CTLFLAG_RW|  CTLFLAG_STATS,
flushwithdeps,
,
"Number of buffers flushed with dependencies that require rollbacks"   
)

◆ SYSCTL_INT() [7/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
maxbcachebuf  ,
CTLFLAG_RDTUN  ,
maxbcachebuf,
,
"Maximum size of a buffer cache block"   
)

◆ SYSCTL_INT() [8/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
numfreebuffers  ,
CTLFLAG_RD  ,
numfreebuffers,
,
"Number of free buffers"   
)

◆ SYSCTL_INT() [9/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
recursiveflushes  ,
CTLFLAG_RW|  CTLFLAG_STATS,
recursiveflushes,
,
"Number of flushes skipped due to being recursive"   
)

◆ SYSCTL_INT() [10/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
unmapped_buf_allowed  ,
CTLFLAG_RD  ,
unmapped_buf_allowed,
,
"Permit the use of the unmapped i/o"   
)

◆ SYSCTL_INT() [11/11]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
vmiodirenable  ,
CTLFLAG_RW  ,
vmiodirenable,
,
"Use the VM system for directory writes"   
)

◆ SYSCTL_LONG() [1/4]

SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
barrierwrites  ,
CTLFLAG_RW|  CTLFLAG_STATS,
barrierwrites,
,
"Number of barrier writes"   
)

◆ SYSCTL_LONG() [2/4]

SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
bufmallocspace  ,
CTLFLAG_RD  ,
bufmallocspace,
,
"Amount of malloced memory for buffers"   
)

◆ SYSCTL_LONG() [3/4]

SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
maxmallocbufspace  ,
CTLFLAG_RW  ,
maxbufmallocspace,
,
"Maximum amount of malloced memory for buffers"   
)

◆ SYSCTL_LONG() [4/4]

SYSCTL_LONG ( _vfs  ,
OID_AUTO  ,
runningbufspace  ,
CTLFLAG_RD  ,
runningbufspace,
,
"Amount of presently outstanding async buffer io"   
)

◆ sysctl_numdirtybuffers()

static int sysctl_numdirtybuffers ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 505 of file vfs_bio.c.

References bdomain, buf_domains, sysctl_handle_int(), and value.

Here is the call graph for this function:

◆ SYSCTL_PROC() [1/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
bufspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RD,
NULL  ,
,
sysctl_bufspace  ,
"L"  ,
"Physical memory used for buffers"   
)

◆ SYSCTL_PROC() [2/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
bufspacethresh  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
bufspacethresh,
__offsetof(struct bufdomain, bd_bufspacethresh ,
sysctl_bufdomain_long  ,
"L"  ,
"Bufspace consumed before waking the daemon to free some"   
)

◆ SYSCTL_PROC() [3/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
dirtybufthresh  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
dirtybufthresh,
__offsetof(struct bufdomain, bd_dirtybufthresh ,
sysctl_bufdomain_int  ,
"I"  ,
"Number of bdwrite to bawrite conversions to clear dirty buffers"   
)

◆ SYSCTL_PROC() [4/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
hibufspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
hibufspace,
__offsetof(struct bufdomain, bd_hibufspace ,
sysctl_bufdomain_long  ,
"L"  ,
"Maximum allowed value of bufspace (excluding metadata)"   
)

◆ SYSCTL_PROC() [5/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
hidirtybuffers  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
hidirtybuffers,
__offsetof(struct bufdomain, bd_hidirtybuffers ,
sysctl_bufdomain_int  ,
"I"  ,
"When the number of dirty buffers is considered severe"   
)

◆ SYSCTL_PROC() [6/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
hifreebuffers  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
hifreebuffers,
__offsetof(struct bufdomain, bd_hifreebuffers ,
sysctl_bufdomain_int  ,
"I"  ,
"Threshold for clean buffer recycling"   
)

◆ SYSCTL_PROC() [7/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
hirunningspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
hirunningspace,
,
sysctl_runningspace  ,
"L"  ,
"Maximum amount of space to use for in-progress I/O"   
)

◆ SYSCTL_PROC() [8/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
lobufspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
lobufspace,
__offsetof(struct bufdomain, bd_lobufspace ,
sysctl_bufdomain_long  ,
"L"  ,
"Minimum amount of buffers we want to have"   
)

◆ SYSCTL_PROC() [9/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
lodirtybuffers  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
lodirtybuffers,
__offsetof(struct bufdomain, bd_lodirtybuffers ,
sysctl_bufdomain_int  ,
"I"  ,
"How many buffers we want to have free before bufdaemon can sleep"   
)

◆ SYSCTL_PROC() [10/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
lofreebuffers  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RW,
lofreebuffers,
__offsetof(struct bufdomain, bd_lofreebuffers ,
sysctl_bufdomain_int  ,
"I"  ,
"Target number of free buffers"   
)

◆ SYSCTL_PROC() [11/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
lorunningspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
lorunningspace,
,
sysctl_runningspace  ,
"L"  ,
"Minimum preferred space used for in-progress I/O"   
)

◆ SYSCTL_PROC() [12/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
maxbufspace  ,
CTLTYPE_LONG|CTLFLAG_MPSAFE|  CTLFLAG_RW,
maxbufspace,
__offsetof(struct bufdomain, bd_maxbufspace ,
sysctl_bufdomain_long  ,
"L"  ,
"Maximum allowed value of bufspace (including metadata)"   
)

◆ SYSCTL_PROC() [13/13]

SYSCTL_PROC ( _vfs  ,
OID_AUTO  ,
numdirtybuffers  ,
CTLTYPE_INT|CTLFLAG_MPSAFE|  CTLFLAG_RD,
NULL  ,
,
sysctl_numdirtybuffers  ,
"I"  ,
"Number of buffers that are dirty (has unwritten changes) at the moment"   
)

◆ sysctl_runningspace()

static int sysctl_runningspace ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 405 of file vfs_bio.c.

References hirunningspace, lorunningspace, rbreqlock, sysctl_handle_long(), and value.

Here is the call graph for this function:

◆ SYSINIT()

SYSINIT ( bufdaemon  ,
SI_SUB_KTHREAD_BUF  ,
SI_ORDER_FIRST  ,
kproc_start  ,
buf_kp 
)

◆ vfs_bio_awrite()

int vfs_bio_awrite ( struct buf bp)

Definition at line 3229 of file vfs_bio.c.

References bremfree(), cluster_wbuild(), maxphys, unmapped_buf, and vfs_bio_clcheck().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_bio_brelse()

void vfs_bio_brelse ( struct buf bp,
int  ioflag 
)

Definition at line 4946 of file vfs_bio.c.

References b_io_dismiss().

Here is the call graph for this function:

◆ vfs_bio_bzero_buf()

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

Definition at line 4895 of file vfs_bio.c.

References BUF_CHECK_MAPPED, and BUF_CHECK_UNMAPPED.

◆ vfs_bio_clcheck()

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

Definition at line 3186 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:

◆ vfs_bio_clrbuf()

void vfs_bio_clrbuf ( struct buf bp)

Definition at line 4853 of file vfs_bio.c.

References mask, vfs_busy_pages_acquire(), and vfs_busy_pages_release().

Here is the call graph for this function:

◆ vfs_bio_getpages()

int vfs_bio_getpages ( struct vnode *  vp,
vm_page_t *  ma,
int  count,
int *  rbehind,
int *  rahead,
vbg_get_lblkno_t  get_lblkno,
vbg_get_blksize_t  get_blksize 
)

Definition at line 5253 of file vfs_bio.c.

References bqrelse(), brelse(), buf, buf_pager_relbuf, count, and crfree().

Here is the call graph for this function:

◆ vfs_bio_set_flags()

void vfs_bio_set_flags ( struct buf bp,
int  ioflag 
)

Definition at line 4953 of file vfs_bio.c.

References b_io_dismiss().

Here is the call graph for this function:

◆ vfs_bio_set_valid()

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

Definition at line 4805 of file vfs_bio.c.

References vfs_busy_pages_acquire(), and vfs_busy_pages_release().

Here is the call graph for this function:

◆ vfs_buf_test_cache()

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 969 of file vfs_bio.c.

Referenced by vfs_vmio_extend().

Here is the caller graph for this function:

◆ vfs_busy_pages()

void vfs_busy_pages ( struct buf bp,
int  clear_modify 
)

Definition at line 4738 of file vfs_bio.c.

References BUF_CHECK_MAPPED, vfs_busy_pages_acquire(), vfs_page_set_validclean(), and vfs_setdirty_range().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_busy_pages_acquire()

void vfs_busy_pages_acquire ( struct buf bp)

Definition at line 4708 of file vfs_bio.c.

Referenced by cluster_rbuild(), cluster_wbuild(), vfs_bio_clrbuf(), vfs_bio_set_valid(), vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

◆ vfs_busy_pages_release()

void vfs_busy_pages_release ( struct buf bp)

Definition at line 4717 of file vfs_bio.c.

Referenced by vfs_bio_clrbuf(), vfs_bio_set_valid(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

◆ vfs_clean_pages_dirty_buf()

static void vfs_clean_pages_dirty_buf ( struct buf bp)
static

Definition at line 3755 of file vfs_bio.c.

References vfs_busy_pages_acquire(), vfs_busy_pages_release(), vfs_page_set_validclean(), and vfs_setdirty_range().

Referenced by bdwrite().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_nonvmio_extend()

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

Definition at line 4297 of file vfs_bio.c.

References bufmallocadjust(), bufmallocspace, bufspace_adjust(), free(), malloc(), maxbufmallocspace, and vm_hold_load_pages().

Referenced by allocbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_nonvmio_truncate()

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

Definition at line 4274 of file vfs_bio.c.

References bufmallocadjust(), bufspace_adjust(), free(), and vm_hold_free_pages().

Referenced by allocbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_page_set_valid()

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

Definition at line 4647 of file vfs_bio.c.

Referenced by vfs_vmio_iodone().

Here is the caller graph for this function:

◆ vfs_page_set_validclean()

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

Definition at line 4676 of file vfs_bio.c.

Referenced by vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

◆ vfs_setdirty_range()

static void vfs_setdirty_range ( struct buf bp)
static

Definition at line 3784 of file vfs_bio.c.

Referenced by vfs_busy_pages(), and vfs_clean_pages_dirty_buf().

Here is the caller graph for this function:

◆ vfs_unbusy_pages()

void vfs_unbusy_pages ( struct buf bp)

Definition at line 4608 of file vfs_bio.c.

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

Here is the call graph for this function:

◆ vfs_vmio_extend()

static void vfs_vmio_extend ( struct buf bp,
int  npages,
int  size 
)
static

Definition at line 3104 of file vfs_bio.c.

References bpmap_qenter(), BUF_CHECK_UNMAPPED, maxbcachebuf, and vfs_buf_test_cache().

Referenced by allocbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_vmio_invalidate()

static void vfs_vmio_invalidate ( struct buf bp)
static

Definition at line 3006 of file vfs_bio.c.

References BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, flags, and panic().

Referenced by brelse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_vmio_iodone()

static void vfs_vmio_iodone ( struct buf bp)
static

Definition at line 2935 of file vfs_bio.c.

References 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:

◆ vfs_vmio_truncate()

static void vfs_vmio_truncate ( struct buf bp,
int  npages 
)
static

Definition at line 3059 of file vfs_bio.c.

References BUF_CHECK_MAPPED, BUF_CHECK_UNMAPPED, and flags.

Referenced by allocbuf().

Here is the caller graph for this function:

◆ vm_hold_free_pages()

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

Definition at line 4997 of file vfs_bio.c.

References BUF_CHECK_MAPPED.

Referenced by vfs_nonvmio_truncate().

Here is the caller graph for this function:

◆ vm_hold_load_pages()

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

Definition at line 4965 of file vfs_bio.c.

References BUF_CHECK_MAPPED, and maxbcachebuf.

Referenced by vfs_nonvmio_extend().

Here is the caller graph for this function:

◆ vmapbuf()

int vmapbuf ( struct buf bp,
void *  uaddr,
size_t  len,
int  mapbuf 
)

Definition at line 5033 of file vfs_bio.c.

References unmapped_buf.

◆ vunmapbuf()

void vunmapbuf ( struct buf bp)

Definition at line 5064 of file vfs_bio.c.

References unmapped_buf.

◆ waitrunningbufspace()

void waitrunningbufspace ( void  )

Definition at line 950 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

◆ altbufferflushes

int altbufferflushes

Definition at line 260 of file vfs_bio.c.

Referenced by bufbdflush().

◆ barrierwrites

long barrierwrites
static

Definition at line 319 of file vfs_bio.c.

Referenced by bufwrite().

◆ bd_bufspacethresh

long bd_bufspacethresh

Definition at line 8 of file vfs_bio.c.

Referenced by bufspace_adjust(), and bufspace_reserve().

◆ bd_cleanq

struct bufqueue* bd_cleanq

Definition at line 2 of file vfs_bio.c.

◆ bd_dirtybufthresh

int bd_dirtybufthresh

Definition at line 13 of file vfs_bio.c.

◆ bd_dirtyq

struct bufqueue bd_dirtyq

Definition at line 1 of file vfs_bio.c.

Referenced by bufqueue().

◆ bd_hibufspace

long bd_hibufspace

Definition at line 6 of file vfs_bio.c.

◆ bd_hidirtybuffers

int bd_hidirtybuffers

Definition at line 11 of file vfs_bio.c.

◆ bd_hifreebuffers

int bd_hifreebuffers

Definition at line 9 of file vfs_bio.c.

◆ bd_lim

int bd_lim

Definition at line 14 of file vfs_bio.c.

◆ bd_lobufspace

long bd_lobufspace

Definition at line 7 of file vfs_bio.c.

◆ bd_lodirtybuffers

int bd_lodirtybuffers

Definition at line 12 of file vfs_bio.c.

◆ bd_lofreebuffers

int bd_lofreebuffers

Definition at line 10 of file vfs_bio.c.

◆ bd_maxbufspace

long bd_maxbufspace

Definition at line 5 of file vfs_bio.c.

◆ bd_request

int bd_request
static

Definition at line 355 of file vfs_bio.c.

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

◆ bd_run_lock

struct mtx_padalign bd_run_lock

Definition at line 3 of file vfs_bio.c.

◆ bd_shutdown

static bool bd_shutdown

Definition at line 17 of file vfs_bio.c.

Referenced by buf_daemon(), and buf_daemon_shutdown().

◆ bd_speedupreq

int bd_speedupreq
static

Definition at line 363 of file vfs_bio.c.

Referenced by bd_speedup(), and buf_daemon().

◆ bd_subq

struct bufqueue bd_subq[MAXCPU+1]

Definition at line 0 of file vfs_bio.c.

Referenced by bufqueue().

◆ bd_wanted

int bd_wanted

Definition at line 16 of file vfs_bio.c.

◆ bdhidirty

struct bufdomainset bdhidirty

Definition at line 390 of file vfs_bio.c.

Referenced by bd_clear(), bd_set(), and buf_dirty_count_severe().

◆ bdirtylock

struct mtx_padalign __exclusive_cache_line bdirtylock
static

Definition at line 343 of file vfs_bio.c.

Referenced by bd_clear(), bd_set(), bdirtywakeup(), bufinit(), and bwillwrite().

◆ bdirtywait

int bdirtywait
static

Definition at line 375 of file vfs_bio.c.

Referenced by bdirtywakeup(), and bwillwrite().

◆ bdlock

struct mtx_padalign __exclusive_cache_line bdlock
static

Definition at line 332 of file vfs_bio.c.

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

◆ bdlodirty

struct bufdomainset bdlodirty

Definition at line 389 of file vfs_bio.c.

Referenced by bd_clear(), bd_set(), and buf_daemon().

◆ bdomain

◆ bdwriteskip

int bdwriteskip

Definition at line 257 of file vfs_bio.c.

◆ bioops

struct bio_ops bioops

Definition at line 96 of file vfs_bio.c.

◆ bq_lock

struct mtx_padalign bq_lock

Definition at line 0 of file vfs_bio.c.

◆ bqempty

struct bufqueue __exclusive_cache_line bqempty

Definition at line 397 of file vfs_bio.c.

Referenced by buf_import(), buf_release(), bufinit(), and bufqueue().

◆ buf

◆ buf_domains

◆ buf_kp

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

Definition at line 3388 of file vfs_bio.c.

◆ buf_ops_bio

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,
}
int bufsync(struct bufobj *bo, int waitfor)
Definition: vfs_bio.c:5101
void bufstrategy(struct bufobj *bo, struct buf *bp)
Definition: vfs_bio.c:5108
void bufbdflush(struct bufobj *bo, struct buf *bp)
Definition: vfs_bio.c:2376
int bufwrite(struct buf *bp)
Definition: vfs_bio.c:2286

Definition at line 98 of file vfs_bio.c.

Referenced by getnewvnode().

◆ buf_pager_relbuf

int buf_pager_relbuf = 0
static

Definition at line 5228 of file vfs_bio.c.

Referenced by vfs_bio_getpages().

◆ buf_wmesg

const char buf_wmesg[] = "bufwait"
static

Definition at line 1186 of file vfs_bio.c.

Referenced by bufinit().

◆ buf_zone

uma_zone_t buf_zone

Definition at line 402 of file vfs_bio.c.

Referenced by buf_alloc(), buf_free(), and bufinit().

◆ bufdaemonproc

struct proc* bufdaemonproc

Definition at line 164 of file vfs_bio.c.

Referenced by flushbufqueues().

◆ bufdefragcnt

counter_u64_t bufdefragcnt
static

Definition at line 243 of file vfs_bio.c.

Referenced by buf_recycle(), and bufinit().

◆ buffreekvacnt

counter_u64_t buffreekvacnt
static

Definition at line 240 of file vfs_bio.c.

Referenced by bufinit(), and bufkva_free().

◆ bufkvaspace

counter_u64_t bufkvaspace
static

Definition at line 211 of file vfs_bio.c.

Referenced by bufinit(), bufkva_alloc(), and bufkva_free().

◆ bufmallocspace

long bufmallocspace
static

Definition at line 219 of file vfs_bio.c.

Referenced by bufmallocadjust(), and vfs_nonvmio_extend().

◆ bufspacethresh

long bufspacethresh

Definition at line 235 of file vfs_bio.c.

Referenced by bufinit().

◆ dirtybufferflushes

int dirtybufferflushes

Definition at line 254 of file vfs_bio.c.

Referenced by bufbdflush().

◆ dirtybufthresh

int dirtybufthresh

Definition at line 280 of file vfs_bio.c.

Referenced by bufinit().

◆ flushbufqtarget

int flushbufqtarget = 100
static

Definition at line 313 of file vfs_bio.c.

Referenced by bufspace_wait().

◆ flushwithdeps

int flushwithdeps = 0
static

Definition at line 3539 of file vfs_bio.c.

Referenced by flushbufqueues().

◆ getnewbufcalls

counter_u64_t getnewbufcalls
static

Definition at line 298 of file vfs_bio.c.

Referenced by bufinit(), and getnewbuf().

◆ getnewbufrestarts

counter_u64_t getnewbufrestarts
static

Definition at line 301 of file vfs_bio.c.

Referenced by bufinit(), and getnewbuf().

◆ hibufspace

long hibufspace

Definition at line 230 of file vfs_bio.c.

Referenced by bufinit().

◆ hidirtybuffers

int hidirtybuffers
static

Definition at line 275 of file vfs_bio.c.

Referenced by bufinit().

◆ hifreebuffers

int hifreebuffers
static

Definition at line 293 of file vfs_bio.c.

Referenced by bufinit().

◆ hirunningspace

long hirunningspace
static

◆ inflight_transient_maps

int inflight_transient_maps
extern

Referenced by biodone().

◆ lobufspace

long lobufspace
static

Definition at line 225 of file vfs_bio.c.

Referenced by bufinit().

◆ lodirtybuffers

int lodirtybuffers
static

Definition at line 270 of file vfs_bio.c.

Referenced by bufinit().

◆ lofreebuffers

int lofreebuffers
static

Definition at line 288 of file vfs_bio.c.

Referenced by bufinit().

◆ lorunningspace

long lorunningspace
static

Definition at line 246 of file vfs_bio.c.

Referenced by buf_daemon(), bufinit(), runningbufwakeup(), and sysctl_runningspace().

◆ mappingrestarts

counter_u64_t mappingrestarts
static

Definition at line 305 of file vfs_bio.c.

Referenced by bp_unmapped_get_kva(), and bufinit().

◆ maxbcachebuf

int maxbcachebuf = MAXBCACHEBUF

◆ maxbufmallocspace

long maxbufmallocspace
static

Definition at line 222 of file vfs_bio.c.

Referenced by bufinit(), and vfs_nonvmio_extend().

◆ maxbufspace

long maxbufspace
static

Definition at line 214 of file vfs_bio.c.

Referenced by bufinit().

◆ nondump_bios

struct bio_queue nondump_bios
static

Definition at line 4409 of file vfs_bio.c.

Referenced by biodone().

◆ notbufdflushes

counter_u64_t notbufdflushes
static

Definition at line 316 of file vfs_bio.c.

Referenced by bufinit(), and flushbufqueues().

◆ numbufallocfails

counter_u64_t numbufallocfails
static

Definition at line 310 of file vfs_bio.c.

Referenced by buf_alloc(), and bufinit().

◆ numfreebuffers

int numfreebuffers
static

Definition at line 285 of file vfs_bio.c.

Referenced by bufinit().

◆ rbreqlock

struct mtx_padalign __exclusive_cache_line rbreqlock
static

Definition at line 338 of file vfs_bio.c.

Referenced by bufinit(), runningwakeup(), sysctl_runningspace(), and waitrunningbufspace().

◆ recursiveflushes

int recursiveflushes
static

Definition at line 263 of file vfs_bio.c.

Referenced by bdwrite().

◆ runningbufreq

int runningbufreq
static

Definition at line 370 of file vfs_bio.c.

Referenced by runningwakeup(), and waitrunningbufspace().

◆ runningbufspace

long runningbufspace

◆ unmapped_buf

◆ vmiodirenable

int vmiodirenable = TRUE

Definition at line 203 of file vfs_bio.c.