Commit 4d1a4765 authored by Damien Le Moal's avatar Damien Le Moal Committed by Jens Axboe

block_dev: Fixed direct I/O bio sector calculation

A direct I/O alignment must be always checked against the device blocks size,
but the I/O offset (bio->bi_iter.bi_sector must always use 512B sector unit, and
not the actual logical block size.
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 778889d8
...@@ -226,7 +226,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, ...@@ -226,7 +226,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
bio.bi_max_vecs = nr_pages; bio.bi_max_vecs = nr_pages;
bio.bi_io_vec = vecs; bio.bi_io_vec = vecs;
bio.bi_bdev = bdev; bio.bi_bdev = bdev;
bio.bi_iter.bi_sector = pos >> blkbits; bio.bi_iter.bi_sector = pos >> 9;
bio.bi_private = current; bio.bi_private = current;
bio.bi_end_io = blkdev_bio_end_io_simple; bio.bi_end_io = blkdev_bio_end_io_simple;
...@@ -358,7 +358,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages) ...@@ -358,7 +358,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
for (;;) { for (;;) {
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
bio->bi_iter.bi_sector = pos >> blkbits; bio->bi_iter.bi_sector = pos >> 9;
bio->bi_private = dio; bio->bi_private = dio;
bio->bi_end_io = blkdev_bio_end_io; bio->bi_end_io = blkdev_bio_end_io;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment