]> git.baikalelectronics.ru Git - kernel.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)
committerJens Axboe <axboe@fb.com>
Tue, 5 May 2015 19:32:49 +0000 (13:32 -0600)
commit52b336dde9ecbe9219e3cb6f91c2988d84a94ab3
treea1a066d7f6deb7d66403137b8edafb394ce0ca6a
parent7ac97e74b4c00714e1645337e49acd0c180d28f1
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>
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