summaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2016-11-22 15:38:49 +0900
committerJens Axboe <axboe@fb.com>2016-11-22 08:09:09 -0700
commit4d1a4765426fb57439164089b3cb537ec65356eb (patch)
tree6991c8002d4ff2b4d41e48efda0bff7cff419c35 /fs/block_dev.c
parent778889d8412e36e666b1e4ce108373613c84b428 (diff)
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: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 35cc494f2e1a..e49fb797e447 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -226,7 +226,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
bio.bi_max_vecs = nr_pages;
bio.bi_io_vec = vecs;
bio.bi_bdev = bdev;
- bio.bi_iter.bi_sector = pos >> blkbits;
+ bio.bi_iter.bi_sector = pos >> 9;
bio.bi_private = current;
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)
for (;;) {
bio->bi_bdev = bdev;
- bio->bi_iter.bi_sector = pos >> blkbits;
+ bio->bi_iter.bi_sector = pos >> 9;
bio->bi_private = dio;
bio->bi_end_io = blkdev_bio_end_io;