diff options
| author | Jens Axboe <axboe@suse.de> | 2002-09-17 18:59:58 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@suse.de> | 2002-09-17 18:59:58 -0700 |
| commit | f8b46092db20bcd663da4e0976892896b4399148 (patch) | |
| tree | 3d26d143031aa5dd3096ed79e9f352b1af11b2b3 /include | |
| parent | efbb72f9ef258905a60a7bdae90214ef20e6ef15 (diff) | |
[PATCH] bio_add_page()
This is bio_add_page(), 100% identical to the version I sent out for
comments earlier this week. With the previous queue restriction patch,
this guarentees that we can always add a page worth of data to the bio.
bio_add_page() returns 0 on success, and 1 on failure. Either the page
is added completely, or the attempt is aborted.
bio_add_page() uses the normal queue restrictions to determine whether
we an add the page or not. if a queue has further restrictions, it can
define a q->merge_bvec_fn() to further impose limits.
Patch also includes changes to ll_rw_kio(), if for nothing else to
demonstrate how to use this piece of instrastructure.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bio.h | 10 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 5fdfd8e8936c..8113ca45c3d2 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -37,8 +37,9 @@ #define BIO_BUG_ON #endif -#define BIO_MAX_SECTORS 128 -#define BIO_MAX_SIZE (BIO_MAX_SECTORS << 9) +#define BIO_MAX_PAGES (256) +#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT) +#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) /* * was unsigned short, but we might as well be ready for > 64kB I/O pages @@ -101,6 +102,7 @@ struct bio { #define BIO_EOF 2 /* out-out-bounds error */ #define BIO_SEG_VALID 3 /* nr_hw_seg valid */ #define BIO_CLONED 4 /* doesn't own data */ +#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) /* * bio bi_rw flags @@ -123,7 +125,7 @@ struct bio { #define bio_offset(bio) bio_iovec((bio))->bv_offset #define bio_sectors(bio) ((bio)->bi_size >> 9) #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio))) -#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_BARRIER)) +#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) /* * will die @@ -203,6 +205,8 @@ extern struct bio *bio_copy(struct bio *, int, int); extern inline void bio_init(struct bio *); +extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); + #ifdef CONFIG_HIGHMEM /* * remember to add offset! and never ever reenable interrupts between a diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 70781c985caa..841295073ffa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -120,6 +120,9 @@ typedef int (make_request_fn) (request_queue_t *q, struct bio *bio); typedef int (prep_rq_fn) (request_queue_t *, struct request *); typedef void (unplug_fn) (void *q); +struct bio_vec; +typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); + enum blk_queue_state { Queue_down, Queue_up, @@ -163,6 +166,7 @@ struct request_queue make_request_fn *make_request_fn; prep_rq_fn *prep_rq_fn; unplug_fn *unplug_fn; + merge_bvec_fn *merge_bvec_fn; struct backing_dev_info backing_dev_info; |
