]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
rbd: use bio_clone_fast() instead of bio_clone()
authorNeilBrown <neilb@suse.com>
Sun, 18 Jun 2017 04:38:58 +0000 (14:38 +1000)
committerJens Axboe <axboe@kernel.dk>
Sun, 18 Jun 2017 18:40:59 +0000 (12:40 -0600)
commitf856dc36b6db4cbe757f95787136087fb37af2af
tree8aa36bbe56deb1622e4042803fa12d4babd5a632
parenta8821f3f32bea173c7f9546b3b025898f0e09f58
rbd: use bio_clone_fast() instead of bio_clone()

bio_clone() makes a copy of the bi_io_vec, but rbd never changes that,
so there is no need for a copy.
bio_clone_fast() can be used instead, which avoids making the copy.

This requires that we provide a bio_set.  bio_clone() uses fs_bio_set,
but it isn't, in general, safe to use the same bio_set at different
levels of the stack, as that can lead to deadlocks.  As filesystems
use fs_bio_set, block devices shouldn't.

As rbd never stacks, it is safe to have a single global bio_set for
all rbd devices to use.  So allocate that when the module is
initialised, and use it with bio_clone_fast().

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rbd.c