FreeBSD kernel kern code
vfs_cluster.c File Reference
#include <sys/cdefs.h>
#include "opt_debug_cluster.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/resourcevar.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 ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_SEGMENT,"cl_savebuf","cluster_save buffer")
 
static struct cluster_save * cluster_collectbufs (struct vnode *vp, 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")
 
int cluster_read (struct vnode *vp, u_quad_t filesize, daddr_t lblkno, long size, struct ucred *cred, long totread, int seqcount, struct buf **bpp)
 
int cluster_read_gb (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 buf *bp, u_quad_t filesize, int seqcount)
 
void cluster_write_gb (struct vnode *vp, 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 cluster_wbuild_gb (struct vnode *vp, long size, daddr_t start_lbn, int len, int gbflags)
 

Variables

static int write_behind = 1
 
static int read_max = 64
 
static int read_min = 1
 
vm_page_t bogus_page
 

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static void cluster_callback ( struct buf bp)
static

Definition at line 533 of file vfs_cluster.c.

References buf, and bufdone().

Referenced by cluster_rbuild(), and cluster_wbuild_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1040 of file vfs_cluster.c.

References bread_gb(), buf, and malloc().

Referenced by cluster_write_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

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 318 of file vfs_cluster.c.

References bogus_page, bqrelse(), brelse(), buf, cluster_callback(), getblk(), panic(), printf(), and unmapped_buf.

Referenced by cluster_read_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 90 of file vfs_cluster.c.

References cluster_read_gb().

Here is the call graph for this function:

int cluster_read_gb ( 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 99 of file vfs_cluster.c.

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

Referenced by cluster_read().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 781 of file vfs_cluster.c.

References cluster_wbuild_gb().

Here is the call graph for this function:

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

Definition at line 788 of file vfs_cluster.c.

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

Referenced by cluster_wbuild(), cluster_wbuild_wb(), and vfs_bio_awrite().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 590 of file vfs_cluster.c.

References cluster_wbuild_gb(), and write_behind.

Referenced by cluster_write_gb().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 622 of file vfs_cluster.c.

References cluster_write_gb().

Here is the call graph for this function:

void cluster_write_gb ( struct vnode *  vp,
struct buf bp,
u_quad_t  filesize,
int  seqcount,
int  gbflags 
)

Definition at line 629 of file vfs_cluster.c.

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

Referenced by cluster_write().

Here is the call graph for this function:

Here is the caller graph for this function:

static MALLOC_DEFINE ( M_SEGMENT  ,
"cl_savebuf"  ,
"cluster_save buffer"   
)
static
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
write_behind  ,
CTLFLAG_RW  ,
write_behind,
,
"Cluster write-behind; 0:  disable,
1:enable  ,
2:backed off"   
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
read_max  ,
CTLFLAG_RW  ,
read_max,
,
"Cluster read-ahead max block count  
)
SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
read_min  ,
CTLFLAG_RW  ,
read_min,
,
"Cluster read min block count  
)

Variable Documentation

vm_page_t bogus_page
int read_max = 64
static

Definition at line 74 of file vfs_cluster.c.

Referenced by cluster_read_gb().

int read_min = 1
static

Definition at line 78 of file vfs_cluster.c.

Referenced by cluster_read_gb().

int write_behind = 1
static

Definition at line 70 of file vfs_cluster.c.

Referenced by cluster_wbuild_wb().