]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bio: skip atomic inc/dec of ->bi_cnt for most use cases
authorJens Axboe <axboe@fb.com>
Fri, 17 Apr 2015 22:23:59 +0000 (16:23 -0600)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 10 Mar 2016 14:47:31 +0000 (06:47 -0800)
commita77f05e7ee1a3b567bb3e260a9edcb6f38f404ef
tree1ab2839b90907d5c1ee4b244e1a5b763d82f16af
parent00f40ad268eeed38de946e8716b1675e60ab575d
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>
(cherry picked from commit dac56212e8127dbc0bff7be35c508bc280213309)

Orabug: 22820562
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
block/bio.c
drivers/md/bcache/request.c
fs/btrfs/volumes.c
fs/xfs/xfs_aops.c
include/linux/bio.h
include/linux/blk_types.h