summaryrefslogtreecommitdiffstats
path: root/include/linux/blk_types.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-04-17 16:23:59 -0600
committerJens Axboe <axboe@fb.com>2015-05-05 13:32:49 -0600
commitdac56212e8127dbc0bff7be35c508bc280213309 (patch)
treea1a066d7f6deb7d66403137b8edafb394ce0ca6a /include/linux/blk_types.h
parentc4cf5261f8bffd9de132b50660a69148e7575bd6 (diff)
downloadop-kernel-dev-dac56212e8127dbc0bff7be35c508bc280213309.zip
op-kernel-dev-dac56212e8127dbc0bff7be35c508bc280213309.tar.gz
bio: skip atomic inc/dec of ->bi_cnt for most use cases
Struct bio has a reference count that controls when it can be freed. Most uses cases is allocating the bio, which then returns with a single reference to it, doing IO, and then dropping that single reference. We can remove this atomic_dec_and_test() in the completion path, if nobody else is holding a reference to the bio. If someone does call bio_get() on the bio, then we flag the bio as now having valid count and that we must properly honor the reference count when it's being put. Tested-by: Robert Elliott <elliott@hp.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/blk_types.h')
-rw-r--r--include/linux/blk_types.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 8b07e06..93d2e71 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -92,7 +92,7 @@ struct bio {
unsigned short bi_max_vecs; /* max bvl_vecs we can hold */
- atomic_t bi_cnt; /* pin count */
+ atomic_t __bi_cnt; /* pin count */
struct bio_vec *bi_io_vec; /* the actual vec list */
@@ -123,6 +123,7 @@ struct bio {
#define BIO_QUIET 9 /* Make BIO Quiet */
#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
#define BIO_CHAIN 11 /* chained bio, ->bi_remaining in effect */
+#define BIO_REFFED 12 /* bio has elevated ->bi_cnt */
/*
* Flags starting here get preserved by bio_reset() - this includes
OpenPOWER on IntegriCloud