Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2421edf authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

bcache: comment on direct access to bvec table



All direct access to bvec table are safe even after multipage bvec is
supported.

Cc: linux-bcache@vger.kernel.org
Acked-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8f50e358
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -432,6 +432,7 @@ static void do_btree_node_write(struct btree *b)


		continue_at(cl, btree_node_write_done, NULL);
		continue_at(cl, btree_node_write_done, NULL);
	} else {
	} else {
		/* No problem for multipage bvec since the bio is just allocated */
		b->bio->bi_vcnt = 0;
		b->bio->bi_vcnt = 0;
		bch_bio_map(b->bio, i);
		bch_bio_map(b->bio, i);


+7 −0
Original line number Original line Diff line number Diff line
@@ -249,6 +249,13 @@ uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done)
		: 0;
		: 0;
}
}


/*
 * Generally it isn't good to access .bi_io_vec and .bi_vcnt directly,
 * the preferred way is bio_add_page, but in this case, bch_bio_map()
 * supposes that the bvec table is empty, so it is safe to access
 * .bi_vcnt & .bi_io_vec in this way even after multipage bvec is
 * supported.
 */
void bch_bio_map(struct bio *bio, void *base)
void bch_bio_map(struct bio *bio, void *base)
{
{
	size_t size = bio->bi_iter.bi_size;
	size_t size = bio->bi_iter.bi_size;