diff options
author | Ming Lei <ming.lei@redhat.com> | 2017-12-18 20:22:09 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-01-06 09:18:00 -0700 |
commit | c2421edf5f9151d0eb28affbf76e9e4f8ddd03c6 (patch) | |
tree | 2b766d69e02c2941c2996e2902b54fc859625751 | |
parent | 8f50e358153dd68182c714626be4a90b64179cf4 (diff) | |
download | op-kernel-dev-c2421edf5f9151d0eb28affbf76e9e4f8ddd03c6.zip op-kernel-dev-c2421edf5f9151d0eb28affbf76e9e4f8ddd03c6.tar.gz |
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: Coly Li <colyli@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/md/bcache/btree.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/util.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 81e8dc3..02a4cf6 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -432,6 +432,7 @@ static void do_btree_node_write(struct btree *b) continue_at(cl, btree_node_write_done, NULL); } else { + /* No problem for multipage bvec since the bio is just allocated */ b->bio->bi_vcnt = 0; bch_bio_map(b->bio, i); diff --git a/drivers/md/bcache/util.c b/drivers/md/bcache/util.c index e548b8b..61813d2 100644 --- a/drivers/md/bcache/util.c +++ b/drivers/md/bcache/util.c @@ -249,6 +249,13 @@ uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done) : 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) { size_t size = bio->bi_iter.bi_size; |