Skip to content
Commit dac56212 authored by Jens Axboe's avatar Jens Axboe
Browse files

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: default avatarRobert Elliott <elliott@hp.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c4cf5261
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment