Draw the outline of "struct bio".

Struct bio is the future carrier of I/O requests for "struct buf".
This commit is contained in:
Poul-Henning Kamp 2000-04-02 09:26:51 +00:00
parent 03be717064
commit 8c125869a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58926
4 changed files with 75 additions and 25 deletions

View File

@ -246,3 +246,9 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
#include <sys/conf.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, specinfo, CTLFLAG_RD,
0, sizeof(struct specinfo), "sizeof(struct specinfo)");
#include <sys/buf.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD,
0, sizeof(struct bio), "sizeof(struct bio)");
SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
0, sizeof(struct buf), "sizeof(struct buf)");

View File

@ -2620,7 +2620,7 @@ void
biodone(register struct buf * bp)
{
int s;
void (*b_iodone) __P((struct buf *));
void (*biodone) __P((struct buf *));
s = splbio();
@ -2641,9 +2641,9 @@ biodone(register struct buf * bp)
/* call optional completion function if requested */
if (bp->b_iodone != NULL) {
b_iodone = bp->b_iodone;
biodone = bp->b_iodone;
bp->b_iodone = NULL;
(*b_iodone) (bp);
(*biodone) (bp);
splx(s);
return;
}

View File

@ -79,6 +79,25 @@ struct iodone_chain {
} ic_args[5];
};
/*
* The bio structure descripes an I/O operation in the kernel.
*/
struct bio {
u_int bio_cmd; /* BIO_READ, BIO_WRITE, BIO_DELETE */
dev_t bio_dev; /* Device to do I/O on */
daddr_t bio_blkno; /* Underlying physical block number. */
u_int bio_flags; /* BIO_ORDERED, BIO_ERROR */
struct buf *__bio_buf; /* Parent buffer */
int bio_error; /* Errno for BIO_ERROR */
long bio_resid; /* Remaining I/0 in bytes */
void (*bio_done) __P((struct buf *));
void *bio_driver1; /* for private use by the driver */
void *bio_driver2; /* for private use by the driver */
void *bio_caller1; /* for private use by the caller */
void *bio_caller2; /* for private use by the caller */
};
/*
* The buffer header describes an I/O operation in the kernel.
*
@ -96,29 +115,36 @@ struct iodone_chain {
* completes, b_resid is usually 0 indicating 100% success.
*/
struct buf {
struct bio b_bio; /* I/O request
* XXX: Must be first element for now
*/
#define b_iocmd b_bio.bio_cmd
#define b_ioflags b_bio.bio_flags
#define b_iodone b_bio.bio_done
#define b_error b_bio.bio_error
#define b_resid b_bio.bio_resid
#define b_blkno b_bio.bio_blkno
#define b_driver1 b_bio.bio_driver1
#define b_driver2 b_bio.bio_driver2
#define b_caller1 b_bio.bio_caller1
#define b_caller2 b_bio.bio_caller2
#define b_dev b_bio.bio_dev
LIST_ENTRY(buf) b_hash; /* Hash chain. */
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
TAILQ_ENTRY(buf) b_act; /* Device driver queue when active. *new* */
u_int b_iocmd; /* BIO_READ, BIO_WRITE, BIO_DELETE */
long b_flags; /* B_* flags. */
unsigned short b_qindex; /* buffer queue index */
unsigned char b_xflags; /* extra flags */
struct lock b_lock; /* Buffer lock */
int b_error; /* Errno value. */
long b_bufsize; /* Allocated buffer size. */
long b_bcount; /* Valid bytes in buffer. */
long b_resid; /* Remaining I/O. */
dev_t b_dev; /* Device associated with buffer. */
caddr_t b_data; /* Memory, superblocks, indirect etc. */
caddr_t b_kvabase; /* base kva for buffer */
int b_kvasize; /* size of kva for buffer */
daddr_t b_lblkno; /* Logical block number. */
daddr_t b_blkno; /* Underlying physical block number. */
off_t b_offset; /* Offset into file */
/* Function to call upon completion. */
void (*b_iodone) __P((struct buf *));
/* For nested b_iodone's. */
struct iodone_chain *b_iodone_chain;
struct vnode *b_vp; /* Device vnode. */
int b_dirtyoff; /* Offset in buffer of dirty region. */
@ -127,10 +153,6 @@ struct buf {
struct ucred *b_wcred; /* Write credentials reference. */
daddr_t b_pblkno; /* physical block number */
void *b_saveaddr; /* Original b_addr for physio. */
void *b_driver1; /* for private use by the driver */
void *b_driver2; /* for private use by the driver */
void *b_caller1; /* for private use by the caller */
void *b_caller2; /* for private use by the caller */
union pager_info {
void *pg_spc;
int pg_reqpage;

View File

@ -79,6 +79,25 @@ struct iodone_chain {
} ic_args[5];
};
/*
* The bio structure descripes an I/O operation in the kernel.
*/
struct bio {
u_int bio_cmd; /* BIO_READ, BIO_WRITE, BIO_DELETE */
dev_t bio_dev; /* Device to do I/O on */
daddr_t bio_blkno; /* Underlying physical block number. */
u_int bio_flags; /* BIO_ORDERED, BIO_ERROR */
struct buf *__bio_buf; /* Parent buffer */
int bio_error; /* Errno for BIO_ERROR */
long bio_resid; /* Remaining I/0 in bytes */
void (*bio_done) __P((struct buf *));
void *bio_driver1; /* for private use by the driver */
void *bio_driver2; /* for private use by the driver */
void *bio_caller1; /* for private use by the caller */
void *bio_caller2; /* for private use by the caller */
};
/*
* The buffer header describes an I/O operation in the kernel.
*
@ -96,29 +115,36 @@ struct iodone_chain {
* completes, b_resid is usually 0 indicating 100% success.
*/
struct buf {
struct bio b_bio; /* I/O request
* XXX: Must be first element for now
*/
#define b_iocmd b_bio.bio_cmd
#define b_ioflags b_bio.bio_flags
#define b_iodone b_bio.bio_done
#define b_error b_bio.bio_error
#define b_resid b_bio.bio_resid
#define b_blkno b_bio.bio_blkno
#define b_driver1 b_bio.bio_driver1
#define b_driver2 b_bio.bio_driver2
#define b_caller1 b_bio.bio_caller1
#define b_caller2 b_bio.bio_caller2
#define b_dev b_bio.bio_dev
LIST_ENTRY(buf) b_hash; /* Hash chain. */
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
TAILQ_ENTRY(buf) b_act; /* Device driver queue when active. *new* */
u_int b_iocmd; /* BIO_READ, BIO_WRITE, BIO_DELETE */
long b_flags; /* B_* flags. */
unsigned short b_qindex; /* buffer queue index */
unsigned char b_xflags; /* extra flags */
struct lock b_lock; /* Buffer lock */
int b_error; /* Errno value. */
long b_bufsize; /* Allocated buffer size. */
long b_bcount; /* Valid bytes in buffer. */
long b_resid; /* Remaining I/O. */
dev_t b_dev; /* Device associated with buffer. */
caddr_t b_data; /* Memory, superblocks, indirect etc. */
caddr_t b_kvabase; /* base kva for buffer */
int b_kvasize; /* size of kva for buffer */
daddr_t b_lblkno; /* Logical block number. */
daddr_t b_blkno; /* Underlying physical block number. */
off_t b_offset; /* Offset into file */
/* Function to call upon completion. */
void (*b_iodone) __P((struct buf *));
/* For nested b_iodone's. */
struct iodone_chain *b_iodone_chain;
struct vnode *b_vp; /* Device vnode. */
int b_dirtyoff; /* Offset in buffer of dirty region. */
@ -127,10 +153,6 @@ struct buf {
struct ucred *b_wcred; /* Write credentials reference. */
daddr_t b_pblkno; /* physical block number */
void *b_saveaddr; /* Original b_addr for physio. */
void *b_driver1; /* for private use by the driver */
void *b_driver2; /* for private use by the driver */
void *b_caller1; /* for private use by the caller */
void *b_caller2; /* for private use by the caller */
union pager_info {
void *pg_spc;
int pg_reqpage;