X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/0a8aee15320dd5b32f4f0651e3dee5e934057b01..72d6a027d96b30c52d242ce162021efcecfe2bb9:/sys/sys/buf.h diff --git a/sys/sys/buf.h b/sys/sys/buf.h index f2815077c6..c09f235ed1 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -74,7 +74,7 @@ struct mount; struct vnode; struct xio; -#define NBUF_BIO 4 +#define NBUF_BIO 6 struct buf_rb_tree; struct buf_rb_hash; @@ -165,6 +165,7 @@ struct buf { unsigned char b_act_count; /* similar to vm_page act_count */ unsigned char b_unused01; struct lock b_lock; /* Buffer lock */ + void *b_iosched; /* I/O scheduler priv data */ buf_cmd_t b_cmd; /* I/O command */ int b_bufsize; /* Allocated buffer size. */ int b_runningbufspace; /* when I/O is running, pipelining */ @@ -176,6 +177,7 @@ struct buf { int b_kvasize; /* size of kva for buffer */ int b_dirtyoff; /* Offset in buffer of dirty region. */ int b_dirtyend; /* Offset of end of dirty region. */ + int b_refs; /* FINDBLK_REF / unrefblk() */ struct xio b_xio; /* data buffer page list management */ struct bio_ops *b_ops; /* bio_ops used w/ b_dep */ struct workhead b_dep; /* List of filesystem dependencies. */ @@ -210,6 +212,7 @@ struct buf { #define FINDBLK_TEST 0x0010 /* test only, do not lock */ #define FINDBLK_NBLOCK 0x0020 /* use non-blocking lock, can return NULL */ +#define FINDBLK_REF 0x0040 /* ref the buf to prevent reuse */ /* * These flags are kept in b_flags. @@ -292,10 +295,10 @@ struct buf { #define B_HASHED 0x00000040 /* Indexed via v_rbhash_tree */ #define B_DELWRI 0x00000080 /* Delay I/O until buffer reused. */ #define B_BNOCLIP 0x00000100 /* EOF clipping b_bcount not allowed */ -#define B_UNUSED9 0x00000200 +#define B_HASBOGUS 0x00000200 /* Contains bogus pages */ #define B_EINTR 0x00000400 /* I/O was interrupted */ #define B_ERROR 0x00000800 /* I/O error occurred. */ -#define B_UNUSED12 0x00001000 /* Unused */ +#define B_IODEBUG 0x00001000 /* (Debugging only bread) */ #define B_INVAL 0x00002000 /* Does not contain valid info. */ #define B_LOCKED 0x00004000 /* Locked in core (not reusable). */ #define B_NOCACHE 0x00008000 /* Destroy buffer AND backing store */ @@ -374,8 +377,6 @@ struct cluster_save { extern int nbuf; /* The number of buffer headers */ extern long maxswzone; /* Max KVA for swap structures */ extern long maxbcache; /* Max KVA for buffer cache */ -extern int runningbufspace; -extern int runningbufcount; extern int hidirtybufspace; extern int buf_maxio; /* nominal maximum I/O for buffer */ extern struct buf *buf; /* The buffer headers. */ @@ -389,13 +390,16 @@ extern int bioq_reorder_minor_interval; extern int bioq_reorder_minor_bytes; struct uio; +struct devstat; void bufinit (void); int bd_heatup (void); void bd_wait (int count); +void waitrunningbufspace(void); int buf_dirty_count_severe (void); int buf_runningbufspace_severe (void); void initbufbio(struct buf *); +void uninitbufbio(struct buf *); void reinitbufbio(struct buf *); void clearbiocache(struct bio *); void bremfree (struct buf *); @@ -414,11 +418,13 @@ void brelse (struct buf *); void bqrelse (struct buf *); int vfs_bio_awrite (struct buf *); struct buf *getpbuf (int *); +struct buf *getpbuf_kva (int *); int inmem (struct vnode *, off_t); struct buf *findblk (struct vnode *, off_t, int); struct buf *getblk (struct vnode *, off_t, int, int, int); -struct buf *getcacheblk (struct vnode *, off_t); +struct buf *getcacheblk (struct vnode *, off_t, int); struct buf *geteblk (int); +void unrefblk(struct buf *bp); void regetblk(struct buf *bp); struct bio *push_bio(struct bio *); struct bio *pop_bio(struct bio *); @@ -430,7 +436,7 @@ void biodone_sync (struct bio *); void cluster_append(struct bio *, struct buf *); int cluster_read (struct vnode *, off_t, off_t, int, - size_t, int, struct buf **); + size_t, size_t, struct buf **); int cluster_wbuild (struct vnode *, int, off_t, int); void cluster_write (struct buf *, off_t, int, int); int physread (struct dev_read_args *); @@ -442,15 +448,21 @@ int vmapbuf (struct buf *, caddr_t, int); void vunmapbuf (struct buf *); void relpbuf (struct buf *, int *); void brelvp (struct buf *); -int bgetvp (struct vnode *, struct buf *); +int bgetvp (struct vnode *, struct buf *, int); +void bsetrunningbufspace(struct buf *, int); int allocbuf (struct buf *bp, int size); int scan_all_buffers (int (*)(struct buf *, void *), void *); void reassignbuf (struct buf *); struct buf *trypbuf (int *); +struct buf *trypbuf_kva (int *); void bio_ops_sync(struct mount *mp); void vm_hold_free_pages(struct buf *bp, vm_offset_t from, vm_offset_t to); void vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to); - +void nestiobuf_done(struct bio *mbio, int donebytes, int error, struct devstat *stats); +void nestiobuf_init(struct bio *mbio); +void nestiobuf_add(struct bio *mbio, struct buf *bp, int off, size_t size, struct devstat *stats); +void nestiobuf_start(struct bio *mbio); +void nestiobuf_error(struct bio *mbio, int error); #endif /* _KERNEL */ #endif /* _KERNEL || _KERNEL_STRUCTURES */ #endif /* !_SYS_BUF_H_ */