diff options
author | Jens Axboe <axboe@fb.com> | 2015-04-18 00:23:59 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-05-05 21:32:49 +0200 |
commit | dac56212e8127dbc0bff7be35c508bc280213309 (patch) | |
tree | a1a066d7f6deb7d66403137b8edafb394ce0ca6a /drivers/md/bcache/request.c | |
parent | bio: skip atomic inc/dec of ->bi_remaining for non-chains (diff) | |
download | linux-dac56212e8127dbc0bff7be35c508bc280213309.tar.xz linux-dac56212e8127dbc0bff7be35c508bc280213309.zip |
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 'drivers/md/bcache/request.c')
-rw-r--r-- | drivers/md/bcache/request.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index ab43faddb447..1616f668a4cb 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -619,7 +619,7 @@ static void do_bio_hook(struct search *s, struct bio *orig_bio) bio->bi_end_io = request_endio; bio->bi_private = &s->cl; - atomic_set(&bio->bi_cnt, 3); + bio_cnt_set(bio, 3); } static void search_free(struct closure *cl) |