FreeBSD kernel kern code
vfs_cluster.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/vmmeter.h>
#include <vm/vm.h>
#include <vm/vm_object.h>
#include <vm/vm_page.h>
#include <sys/sysctl.h>
Include dependency graph for vfs_cluster.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_SEGMENT, "cl_savebuf", "cluster_save buffer")
 
static void cluster_init (void *)
 
static struct cluster_save * cluster_collectbufs (struct vnode *vp, struct vn_clusterw *vnc, struct buf *last_bp, int gbflags)
 
static struct bufcluster_rbuild (struct vnode *vp, u_quad_t filesize, daddr_t lbn, daddr_t blkno, long size, int run, int gbflags, struct buf *fbp)
 
static void cluster_callback (struct buf *)
 
 SYSCTL_INT (_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0, "Cluster write-behind; 0: disable, 1: enable, 2: backed off")
 
 SYSCTL_INT (_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0, "Cluster read-ahead max block count")
 
 SYSCTL_INT (_vfs, OID_AUTO, read_min, CTLFLAG_RW, &read_min, 0, "Cluster read min block count")
 
 SYSINIT (cluster, SI_SUB_CPU, SI_ORDER_ANY, cluster_init, NULL)
 
int cluster_read (struct vnode *vp, u_quad_t filesize, daddr_t lblkno, long size, struct ucred *cred, long totread, int seqcount, int gbflags, struct buf **bpp)
 
static __inline int cluster_wbuild_wb (struct vnode *vp, long size, daddr_t start_lbn, int len, int gbflags)
 
void cluster_write (struct vnode *vp, struct vn_clusterw *vnc, struct buf *bp, u_quad_t filesize, int seqcount, int gbflags)
 
int cluster_wbuild (struct vnode *vp, long size, daddr_t start_lbn, int len, int gbflags)
 
void cluster_init_vn (struct vn_clusterw *vnc)
 

Variables

static uma_zone_t cluster_pbuf_zone
 
static int write_behind = 1
 
static int read_max = 64
 
static int read_min = 1
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ cluster_callback()

static void cluster_callback ( struct buf bp)
static

Definition at line 558 of file vfs_cluster.c.

References buf, bufdone(), and cluster_pbuf_zone.

Referenced by cluster_rbuild(), and cluster_wbuild().

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

◆ cluster_collectbufs()

static struct cluster_save * cluster_collectbufs ( struct vnode *  vp,
struct vn_clusterw *  vnc,
struct buf last_bp,
int  gbflags 
)
static

Definition at line 1048 of file vfs_cluster.c.

References brelse(), buf, free(), and malloc().

Referenced by cluster_write().

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

◆ cluster_init()

static void cluster_init ( void *  dummy)
static

Definition at line 83 of file vfs_cluster.c.

References cluster_pbuf_zone, and nswbuf.

◆ cluster_init_vn()

void cluster_init_vn ( struct vn_clusterw *  vnc)

Definition at line 1087 of file vfs_cluster.c.

◆ cluster_rbuild()

static struct buf * cluster_rbuild ( struct vnode *  vp,
u_quad_t  filesize,
daddr_t  lbn,
daddr_t  blkno,
long  size,
int  run,
int  gbflags,
struct buf fbp 
)
static

Definition at line 343 of file vfs_cluster.c.

References bqrelse(), buf, cluster_callback(), cluster_pbuf_zone, getblk(), panic(), printf(), unmapped_buf, and vfs_busy_pages_acquire().

Referenced by cluster_read().

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

◆ cluster_read()

int cluster_read ( struct vnode *  vp,
u_quad_t  filesize,
daddr_t  lblkno,
long  size,
struct ucred *  cred,
long  totread,
int  seqcount,
int  gbflags,
struct buf **  bpp 
)

Definition at line 94 of file vfs_cluster.c.

References bqrelse(), brelse(), buf, bufwait(), cluster_rbuild(), gbincore(), getblk(), getblkx(), nbuf, read_max, read_min, and vfs_busy_pages().

Here is the call graph for this function:

◆ cluster_wbuild()

int cluster_wbuild ( struct vnode *  vp,
long  size,
daddr_t  start_lbn,
int  len,
int  gbflags 
)

Definition at line 811 of file vfs_cluster.c.

References bawrite(), bqrelse(), bremfree(), buf, bufobj_wref(), bundirty(), cluster_callback(), cluster_pbuf_zone, crhold(), gbincore(), panic(), reassignbuf(), unmapped_buf, and vfs_busy_pages_acquire().

Referenced by cluster_wbuild_wb(), and vfs_bio_awrite().

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

◆ cluster_wbuild_wb()

static __inline int cluster_wbuild_wb ( struct vnode *  vp,
long  size,
daddr_t  start_lbn,
int  len,
int  gbflags 
)
static

Definition at line 614 of file vfs_cluster.c.

References cluster_wbuild(), and write_behind.

Referenced by cluster_write().

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

◆ cluster_write()

void cluster_write ( struct vnode *  vp,
struct vn_clusterw *  vnc,
struct buf bp,
u_quad_t  filesize,
int  seqcount,
int  gbflags 
)

Definition at line 646 of file vfs_cluster.c.

References bawrite(), bdwrite(), brelse(), buf, cluster_collectbufs(), cluster_wbuild_wb(), and free().

Here is the call graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_SEGMENT  ,
"cl_savebuf"  ,
"cluster_save buffer"   
)
static

◆ SYSCTL_INT() [1/3]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
read_max  ,
CTLFLAG_RW  ,
read_max,
,
"Cluster read-ahead max block count  
)

◆ SYSCTL_INT() [2/3]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
read_min  ,
CTLFLAG_RW  ,
read_min,
,
"Cluster read min block count  
)

◆ SYSCTL_INT() [3/3]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
write_behind  ,
CTLFLAG_RW  ,
write_behind,
,
"Cluster write-behind; 0:  disable,
1:enable  ,
2:backed off"   
)

◆ SYSINIT()

SYSINIT ( cluster  ,
SI_SUB_CPU  ,
SI_ORDER_ANY  ,
cluster_init  ,
NULL   
)

Variable Documentation

◆ cluster_pbuf_zone

uma_zone_t cluster_pbuf_zone
static

Definition at line 58 of file vfs_cluster.c.

Referenced by cluster_callback(), cluster_init(), cluster_rbuild(), and cluster_wbuild().

◆ read_max

int read_max = 64
static

Definition at line 72 of file vfs_cluster.c.

Referenced by cluster_read().

◆ read_min

int read_min = 1
static

Definition at line 76 of file vfs_cluster.c.

Referenced by cluster_read().

◆ write_behind

int write_behind = 1
static

Definition at line 68 of file vfs_cluster.c.

Referenced by cluster_wbuild_wb().