summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMing Lei2016-11-22 16:57:21 +0100
committerJens Axboe2016-11-22 16:57:21 +0100
commit3a83f4677539bce8eaa2bca9ee9c20e172d7ab04 (patch)
treeedb5ffeed2c07c342bd6d9adb0180fab472c1666 /fs
parentblock_dev: get rid of blksize bits calculation (diff)
downloadkernel-qcow2-linux-3a83f4677539bce8eaa2bca9ee9c20e172d7ab04.tar.gz
kernel-qcow2-linux-3a83f4677539bce8eaa2bca9ee9c20e172d7ab04.tar.xz
kernel-qcow2-linux-3a83f4677539bce8eaa2bca9ee9c20e172d7ab04.zip
block: bio: pass bvec table to bio_init()
Some drivers often use external bvec table, so introduce this helper for this case. It is always safe to access the bio->bi_io_vec in this way for this case. After converting to this usage, it will becomes a bit easier to evaluate the remaining direct access to bio->bi_io_vec, so it can help to prepare for the following multipage bvec support. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Fixed up the new O_DIRECT cases. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c4
-rw-r--r--fs/logfs/dev_bdev.c4
2 files changed, 2 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index b0c790a19db9..7022ddc55b12 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -222,9 +222,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
return -ENOMEM;
}
- bio_init(&bio);
- bio.bi_max_vecs = nr_pages;
- bio.bi_io_vec = vecs;
+ bio_init(&bio, vecs, nr_pages);
bio.bi_bdev = bdev;
bio.bi_iter.bi_sector = pos >> 9;
bio.bi_private = current;
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index a8329cc47dec..dc8cafeee038 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -19,9 +19,7 @@ static int sync_request(struct page *page, struct block_device *bdev, int op)
struct bio bio;
struct bio_vec bio_vec;
- bio_init(&bio);
- bio.bi_max_vecs = 1;
- bio.bi_io_vec = &bio_vec;
+ bio_init(&bio, &bio_vec, 1);
bio_vec.bv_page = page;
bio_vec.bv_len = PAGE_SIZE;
bio_vec.bv_offset = 0;