summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2002-10-07 21:37:12 -0700
committerJens Axboe <axboe@suse.de>2002-10-07 21:37:12 -0700
commit60ac3a30921db0ed32f8ec3ae178a01d04f76876 (patch)
treeedfc260a053e2a55c16e89369123a0ad89c91c62 /include/linux
parent797033409684219aaaf3945b57244624d72e4cea (diff)
[PATCH] make bio->bi_max contain max vec entries
This changes the way we do pool lookups when freeing a bio. Right now we use bi_max as a handle into bvec_array[], to find the pool where it came from. This used to be just fine, because if you had a private bio, you could specify your own destructor. But now we have bio_add_page() which also needs to know where the bio came from, or more precisely, it needs to know how many entries the bio can hold. So I've changed bi_max to bi_max_vecs, it now contains the number of vec entries in the bio. Privately allocated bio's (or on stack) can now just set bio->bi_max_vecs to reflect the max size. The pool index for the default destructor is stored in the top bits of bi_flags.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bio.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index d3d75e2904ba..93ac8216aae4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -81,8 +81,7 @@ struct bio {
unsigned short bi_hw_segments;
unsigned int bi_size; /* residual I/O count */
- unsigned int bi_max; /* max bvl_vecs we can hold,
- used as index into pool */
+ unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
struct bio_vec *bi_io_vec; /* the actual vec list */
@@ -105,6 +104,14 @@ struct bio {
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
/*
+ * top 4 bits of bio flags indicate the pool this bio came from
+ */
+#define BIO_POOL_BITS (4)
+#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
+#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
+#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
+
+/*
* bio bi_rw flags
*
* bit 0 -- read (not set) or write (set)