Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
xfs_buf.h File Reference
#include <linux/list.h>
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/uio.h>

Go to the source code of this file.

Data Structures

struct  xfs_buftarg
 
struct  xfs_buf_map
 
struct  xfs_buf
 

Macros

#define XFS_BUF_DADDR_NULL   ((xfs_daddr_t) (-1LL))
 
#define XBF_READ   (1 << 0) /* buffer intended for reading from device */
 
#define XBF_WRITE   (1 << 1) /* buffer intended for writing to device */
 
#define XBF_READ_AHEAD   (1 << 2) /* asynchronous read-ahead */
 
#define XBF_ASYNC   (1 << 4) /* initiator will not wait for completion */
 
#define XBF_DONE   (1 << 5) /* all pages in the buffer uptodate */
 
#define XBF_STALE   (1 << 6) /* buffer has been staled, do not find it */
 
#define XBF_SYNCIO   (1 << 10)/* treat this buffer as synchronous I/O */
 
#define XBF_FUA   (1 << 11)/* force cache write through mode */
 
#define XBF_FLUSH   (1 << 12)/* flush the disk cache before a write */
 
#define XBF_TRYLOCK   (1 << 16)/* lock requested, but do not wait */
 
#define XBF_UNMAPPED   (1 << 17)/* do not map the buffer */
 
#define _XBF_PAGES   (1 << 20)/* backed by refcounted pages */
 
#define _XBF_KMEM   (1 << 21)/* backed by heap memory */
 
#define _XBF_DELWRI_Q   (1 << 22)/* buffer on a delwri queue */
 
#define _XBF_COMPOUND   (1 << 23)/* compound buffer */
 
#define _XBF_LRU_DISPOSE   (1 << 24)/* buffer being discarded */
 
#define XFS_BUF_FLAGS
 
#define XB_PAGES   2
 
#define DEFINE_SINGLE_BUF_MAP(map, blkno, numblk)   struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };
 
#define xfs_buf_islocked(bp)   ((bp)->b_sema.count <= 0)
 
#define xfs_buf_zero(bp, off, len)   xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
 
#define XFS_BUF_ZEROFLAGS(bp)
 
#define XFS_BUF_UNSTALE(bp)   ((bp)->b_flags &= ~XBF_STALE)
 
#define XFS_BUF_ISSTALE(bp)   ((bp)->b_flags & XBF_STALE)
 
#define XFS_BUF_DONE(bp)   ((bp)->b_flags |= XBF_DONE)
 
#define XFS_BUF_UNDONE(bp)   ((bp)->b_flags &= ~XBF_DONE)
 
#define XFS_BUF_ISDONE(bp)   ((bp)->b_flags & XBF_DONE)
 
#define XFS_BUF_ASYNC(bp)   ((bp)->b_flags |= XBF_ASYNC)
 
#define XFS_BUF_UNASYNC(bp)   ((bp)->b_flags &= ~XBF_ASYNC)
 
#define XFS_BUF_ISASYNC(bp)   ((bp)->b_flags & XBF_ASYNC)
 
#define XFS_BUF_READ(bp)   ((bp)->b_flags |= XBF_READ)
 
#define XFS_BUF_UNREAD(bp)   ((bp)->b_flags &= ~XBF_READ)
 
#define XFS_BUF_ISREAD(bp)   ((bp)->b_flags & XBF_READ)
 
#define XFS_BUF_WRITE(bp)   ((bp)->b_flags |= XBF_WRITE)
 
#define XFS_BUF_UNWRITE(bp)   ((bp)->b_flags &= ~XBF_WRITE)
 
#define XFS_BUF_ISWRITE(bp)   ((bp)->b_flags & XBF_WRITE)
 
#define XFS_BUF_ADDR(bp)   ((bp)->b_map.bm_bn)
 
#define XFS_BUF_SET_ADDR(bp, bno)   ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno))
 
#define xfs_getsize_buftarg(buftarg)   block_size((buftarg)->bt_bdev)
 
#define xfs_readonly_buftarg(buftarg)   bdev_read_only((buftarg)->bt_bdev)
 

Typedefs

typedef unsigned int xfs_buf_flags_t
 
typedef struct xfs_buftarg xfs_buftarg_t
 
typedef void(* xfs_buf_iodone_t )(struct xfs_buf *)
 
typedef struct xfs_buf xfs_buf_t
 

Enumerations

enum  xfs_buf_rw_t { XBRW_READ = 1, XBRW_WRITE = 2, XBRW_ZERO = 3 }
 

Functions

struct xfs_buf_xfs_buf_find (struct xfs_buftarg *target, struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags, struct xfs_buf *new_bp)
 
struct xfs_buf_xfs_buf_alloc (struct xfs_buftarg *target, struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags)
 
struct xfs_bufxfs_buf_get_map (struct xfs_buftarg *target, struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags)
 
struct xfs_bufxfs_buf_read_map (struct xfs_buftarg *target, struct xfs_buf_map *map, int nmaps, xfs_buf_flags_t flags)
 
void xfs_buf_readahead_map (struct xfs_buftarg *target, struct xfs_buf_map *map, int nmaps)
 
struct xfs_bufxfs_buf_get_empty (struct xfs_buftarg *target, size_t numblks)
 
void xfs_buf_set_empty (struct xfs_buf *bp, size_t numblks)
 
int xfs_buf_associate_memory (struct xfs_buf *bp, void *mem, size_t length)
 
struct xfs_bufxfs_buf_get_uncached (struct xfs_buftarg *target, size_t numblks, int flags)
 
struct xfs_bufxfs_buf_read_uncached (struct xfs_buftarg *target, xfs_daddr_t daddr, size_t numblks, int flags)
 
void xfs_buf_hold (struct xfs_buf *bp)
 
void xfs_buf_free (xfs_buf_t *)
 
void xfs_buf_rele (xfs_buf_t *)
 
int xfs_buf_trylock (xfs_buf_t *)
 
void xfs_buf_lock (xfs_buf_t *)
 
void xfs_buf_unlock (xfs_buf_t *)
 
int xfs_bwrite (struct xfs_buf *bp)
 
void xfsbdstrat (struct xfs_mount *, struct xfs_buf *)
 
void xfs_buf_ioend (xfs_buf_t *, int)
 
void xfs_buf_ioerror (xfs_buf_t *, int)
 
void xfs_buf_ioerror_alert (struct xfs_buf *, const char *func)
 
void xfs_buf_iorequest (xfs_buf_t *)
 
int xfs_buf_iowait (xfs_buf_t *)
 
void xfs_buf_iomove (xfs_buf_t *, size_t, size_t, void *, xfs_buf_rw_t)
 
xfs_caddr_t xfs_buf_offset (xfs_buf_t *, size_t)
 
bool xfs_buf_delwri_queue (struct xfs_buf *, struct list_head *)
 
int xfs_buf_delwri_submit (struct list_head *)
 
int xfs_buf_delwri_submit_nowait (struct list_head *)
 
int xfs_buf_init (void)
 
void xfs_buf_terminate (void)
 
void xfs_buf_stale (struct xfs_buf *bp)
 
xfs_buftarg_txfs_alloc_buftarg (struct xfs_mount *, struct block_device *, int, const char *)
 
void xfs_free_buftarg (struct xfs_mount *, struct xfs_buftarg *)
 
void xfs_wait_buftarg (xfs_buftarg_t *)
 
int xfs_setsize_buftarg (xfs_buftarg_t *, unsigned int, unsigned int)
 

Macro Definition Documentation

#define _XBF_COMPOUND   (1 << 23)/* compound buffer */

Definition at line 61 of file xfs_buf.h.

#define _XBF_DELWRI_Q   (1 << 22)/* buffer on a delwri queue */

Definition at line 60 of file xfs_buf.h.

#define _XBF_KMEM   (1 << 21)/* backed by heap memory */

Definition at line 59 of file xfs_buf.h.

#define _XBF_LRU_DISPOSE   (1 << 24)/* buffer being discarded */

Definition at line 62 of file xfs_buf.h.

#define _XBF_PAGES   (1 << 20)/* backed by refcounted pages */

Definition at line 58 of file xfs_buf.h.

#define DEFINE_SINGLE_BUF_MAP (   map,
  blkno,
  numblk 
)    struct xfs_buf_map (map) = { .bm_bn = (blkno), .bm_len = (numblk) };

Definition at line 110 of file xfs_buf.h.

#define XB_PAGES   2

Definition at line 103 of file xfs_buf.h.

#define XBF_ASYNC   (1 << 4) /* initiator will not wait for completion */

Definition at line 44 of file xfs_buf.h.

#define XBF_DONE   (1 << 5) /* all pages in the buffer uptodate */

Definition at line 45 of file xfs_buf.h.

#define XBF_FLUSH   (1 << 12)/* flush the disk cache before a write */

Definition at line 51 of file xfs_buf.h.

#define XBF_FUA   (1 << 11)/* force cache write through mode */

Definition at line 50 of file xfs_buf.h.

#define XBF_READ   (1 << 0) /* buffer intended for reading from device */

Definition at line 41 of file xfs_buf.h.

#define XBF_READ_AHEAD   (1 << 2) /* asynchronous read-ahead */

Definition at line 43 of file xfs_buf.h.

#define XBF_STALE   (1 << 6) /* buffer has been staled, do not find it */

Definition at line 46 of file xfs_buf.h.

#define XBF_SYNCIO   (1 << 10)/* treat this buffer as synchronous I/O */

Definition at line 49 of file xfs_buf.h.

#define XBF_TRYLOCK   (1 << 16)/* lock requested, but do not wait */

Definition at line 54 of file xfs_buf.h.

#define XBF_UNMAPPED   (1 << 17)/* do not map the buffer */

Definition at line 55 of file xfs_buf.h.

#define XBF_WRITE   (1 << 1) /* buffer intended for writing to device */

Definition at line 42 of file xfs_buf.h.

#define XFS_BUF_ADDR (   bp)    ((bp)->b_map.bm_bn)

Definition at line 322 of file xfs_buf.h.

#define XFS_BUF_ASYNC (   bp)    ((bp)->b_flags |= XBF_ASYNC)

Definition at line 300 of file xfs_buf.h.

#define XFS_BUF_DADDR_NULL   ((xfs_daddr_t) (-1LL))

Definition at line 33 of file xfs_buf.h.

#define XFS_BUF_DONE (   bp)    ((bp)->b_flags |= XBF_DONE)

Definition at line 296 of file xfs_buf.h.

#define XFS_BUF_FLAGS
Value:
{ XBF_READ, "READ" }, \
{ XBF_WRITE, "WRITE" }, \
{ XBF_READ_AHEAD, "READ_AHEAD" }, \
{ XBF_ASYNC, "ASYNC" }, \
{ XBF_DONE, "DONE" }, \
{ XBF_STALE, "STALE" }, \
{ XBF_SYNCIO, "SYNCIO" }, \
{ XBF_FUA, "FUA" }, \
{ XBF_FLUSH, "FLUSH" }, \
{ XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\
{ XBF_UNMAPPED, "UNMAPPED" }, /* ditto */\
{ _XBF_PAGES, "PAGES" }, \
{ _XBF_KMEM, "KMEM" }, \
{ _XBF_DELWRI_Q, "DELWRI_Q" }, \
{ _XBF_COMPOUND, "COMPOUND" }, \
{ _XBF_LRU_DISPOSE, "LRU_DISPOSE" }

Definition at line 66 of file xfs_buf.h.

#define XFS_BUF_ISASYNC (   bp)    ((bp)->b_flags & XBF_ASYNC)

Definition at line 302 of file xfs_buf.h.

#define XFS_BUF_ISDONE (   bp)    ((bp)->b_flags & XBF_DONE)

Definition at line 298 of file xfs_buf.h.

#define xfs_buf_islocked (   bp)    ((bp)->b_sema.count <= 0)

Definition at line 253 of file xfs_buf.h.

#define XFS_BUF_ISREAD (   bp)    ((bp)->b_flags & XBF_READ)

Definition at line 306 of file xfs_buf.h.

#define XFS_BUF_ISSTALE (   bp)    ((bp)->b_flags & XBF_STALE)

Definition at line 294 of file xfs_buf.h.

#define XFS_BUF_ISWRITE (   bp)    ((bp)->b_flags & XBF_WRITE)

Definition at line 310 of file xfs_buf.h.

#define XFS_BUF_READ (   bp)    ((bp)->b_flags |= XBF_READ)

Definition at line 304 of file xfs_buf.h.

#define XFS_BUF_SET_ADDR (   bp,
  bno 
)    ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno))

Definition at line 323 of file xfs_buf.h.

#define XFS_BUF_UNASYNC (   bp)    ((bp)->b_flags &= ~XBF_ASYNC)

Definition at line 301 of file xfs_buf.h.

#define XFS_BUF_UNDONE (   bp)    ((bp)->b_flags &= ~XBF_DONE)

Definition at line 297 of file xfs_buf.h.

#define XFS_BUF_UNREAD (   bp)    ((bp)->b_flags &= ~XBF_READ)

Definition at line 305 of file xfs_buf.h.

#define XFS_BUF_UNSTALE (   bp)    ((bp)->b_flags &= ~XBF_STALE)

Definition at line 293 of file xfs_buf.h.

#define XFS_BUF_UNWRITE (   bp)    ((bp)->b_flags &= ~XBF_WRITE)

Definition at line 309 of file xfs_buf.h.

#define XFS_BUF_WRITE (   bp)    ((bp)->b_flags |= XBF_WRITE)

Definition at line 308 of file xfs_buf.h.

#define xfs_buf_zero (   bp,
  off,
  len 
)    xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)

Definition at line 268 of file xfs_buf.h.

#define XFS_BUF_ZEROFLAGS (   bp)
Value:

Definition at line 288 of file xfs_buf.h.

#define xfs_getsize_buftarg (   buftarg)    block_size((buftarg)->bt_bdev)

Definition at line 350 of file xfs_buf.h.

#define xfs_readonly_buftarg (   buftarg)    bdev_read_only((buftarg)->bt_bdev)

Definition at line 351 of file xfs_buf.h.

Typedef Documentation

typedef unsigned int xfs_buf_flags_t

Definition at line 64 of file xfs_buf.h.

typedef void(* xfs_buf_iodone_t)(struct xfs_buf *)

Definition at line 101 of file xfs_buf.h.

Enumeration Type Documentation

Enumerator:
XBRW_READ 
XBRW_WRITE 
XBRW_ZERO 

Definition at line 35 of file xfs_buf.h.

Function Documentation

struct xfs_buf* _xfs_buf_alloc ( struct xfs_buftarg target,
struct xfs_buf_map map,
int  nmaps,
xfs_buf_flags_t  flags 
)
read

Definition at line 203 of file xfs_buf.c.

struct xfs_buf* _xfs_buf_find ( struct xfs_buftarg target,
struct xfs_buf_map map,
int  nmaps,
xfs_buf_flags_t  flags,
struct xfs_buf new_bp 
)
read

Definition at line 477 of file xfs_buf.c.

xfs_buftarg_t* xfs_alloc_buftarg ( struct xfs_mount *  ,
struct block_device ,
int  ,
const char  
)

Definition at line 1591 of file xfs_buf.c.

int xfs_buf_associate_memory ( struct xfs_buf bp,
void mem,
size_t  length 
)

Definition at line 772 of file xfs_buf.c.

bool xfs_buf_delwri_queue ( struct xfs_buf ,
struct list_head  
)

Definition at line 1634 of file xfs_buf.c.

int xfs_buf_delwri_submit ( struct list_head )

Definition at line 1775 of file xfs_buf.c.

int xfs_buf_delwri_submit_nowait ( struct list_head )

Definition at line 1759 of file xfs_buf.c.

void xfs_buf_free ( xfs_buf_t )

Definition at line 310 of file xfs_buf.c.

struct xfs_buf* xfs_buf_get_empty ( struct xfs_buftarg target,
size_t  numblks 
)
read
struct xfs_buf* xfs_buf_get_map ( struct xfs_buftarg target,
struct xfs_buf_map map,
int  nmaps,
xfs_buf_flags_t  flags 
)
read

Definition at line 586 of file xfs_buf.c.

struct xfs_buf* xfs_buf_get_uncached ( struct xfs_buftarg target,
size_t  numblks,
int  flags 
)
read

Definition at line 814 of file xfs_buf.c.

void xfs_buf_hold ( struct xfs_buf bp)

Definition at line 867 of file xfs_buf.c.

int xfs_buf_init ( void  )

Definition at line 1799 of file xfs_buf.c.

void xfs_buf_ioend ( xfs_buf_t ,
int   
)

Definition at line 1012 of file xfs_buf.c.

void xfs_buf_ioerror ( xfs_buf_t ,
int   
)

Definition at line 1035 of file xfs_buf.c.

void xfs_buf_ioerror_alert ( struct xfs_buf ,
const char func 
)

Definition at line 1045 of file xfs_buf.c.

void xfs_buf_iomove ( xfs_buf_t ,
size_t  ,
size_t  ,
void ,
xfs_buf_rw_t   
)

Definition at line 1405 of file xfs_buf.c.

void xfs_buf_iorequest ( xfs_buf_t )

Definition at line 1346 of file xfs_buf.c.

int xfs_buf_iowait ( xfs_buf_t )

Definition at line 1374 of file xfs_buf.c.

void xfs_buf_lock ( xfs_buf_t )

Definition at line 951 of file xfs_buf.c.

xfs_caddr_t xfs_buf_offset ( xfs_buf_t ,
size_t   
)

Definition at line 1387 of file xfs_buf.c.

struct xfs_buf* xfs_buf_read_map ( struct xfs_buftarg target,
struct xfs_buf_map map,
int  nmaps,
xfs_buf_flags_t  flags 
)
read

Definition at line 653 of file xfs_buf.c.

struct xfs_buf* xfs_buf_read_uncached ( struct xfs_buftarg target,
xfs_daddr_t  daddr,
size_t  numblks,
int  flags 
)
read

Definition at line 708 of file xfs_buf.c.

void xfs_buf_readahead_map ( struct xfs_buftarg target,
struct xfs_buf_map map,
int  nmaps 
)

Definition at line 691 of file xfs_buf.c.

void xfs_buf_rele ( xfs_buf_t )

Definition at line 879 of file xfs_buf.c.

void xfs_buf_set_empty ( struct xfs_buf bp,
size_t  numblks 
)

Definition at line 741 of file xfs_buf.c.

void xfs_buf_stale ( struct xfs_buf bp)

Definition at line 139 of file xfs_buf.c.

void xfs_buf_terminate ( void  )

Definition at line 1820 of file xfs_buf.c.

int xfs_buf_trylock ( xfs_buf_t )

Definition at line 926 of file xfs_buf.c.

void xfs_buf_unlock ( xfs_buf_t )

Definition at line 965 of file xfs_buf.c.

int xfs_bwrite ( struct xfs_buf bp)

Definition at line 1145 of file xfs_buf.c.

void xfs_free_buftarg ( struct xfs_mount *  ,
struct xfs_buftarg  
)

Definition at line 1530 of file xfs_buf.c.

int xfs_setsize_buftarg ( xfs_buftarg_t ,
unsigned  int,
unsigned  int 
)

Definition at line 1582 of file xfs_buf.c.

void xfs_wait_buftarg ( xfs_buftarg_t )

Definition at line 1453 of file xfs_buf.c.

void xfsbdstrat ( struct xfs_mount *  ,
struct xfs_buf  
)

Definition at line 1171 of file xfs_buf.c.