diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-19 01:16:16 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:32:52 -0400 |
commit | f67da30c1d5fc9e341bc8121708874bfd7b31e45 (patch) | |
tree | 504966ed27e82dbcbe31786c9a0851a4ae79ef3e /fs/direct-io.c | |
parent | 5b46f25ddc6edf4adff1a137d453da542c27a640 (diff) |
new helper: iov_iter_npages()
counts the pages covered by iov_iter, up to given limit.
do_block_direct_io() and fuse_iter_npages() switched to
it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r-- | fs/direct-io.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 4b410d58faae..98040ba388ac 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -1100,7 +1100,6 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1100 | get_block_t get_block, dio_iodone_t end_io, | 1100 | get_block_t get_block, dio_iodone_t end_io, |
1101 | dio_submit_t submit_io, int flags) | 1101 | dio_submit_t submit_io, int flags) |
1102 | { | 1102 | { |
1103 | int seg; | ||
1104 | unsigned i_blkbits = ACCESS_ONCE(inode->i_blkbits); | 1103 | unsigned i_blkbits = ACCESS_ONCE(inode->i_blkbits); |
1105 | unsigned blkbits = i_blkbits; | 1104 | unsigned blkbits = i_blkbits; |
1106 | unsigned blocksize_mask = (1 << blkbits) - 1; | 1105 | unsigned blocksize_mask = (1 << blkbits) - 1; |
@@ -1108,7 +1107,6 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1108 | loff_t end = offset + iov_iter_count(iter); | 1107 | loff_t end = offset + iov_iter_count(iter); |
1109 | struct dio *dio; | 1108 | struct dio *dio; |
1110 | struct dio_submit sdio = { 0, }; | 1109 | struct dio_submit sdio = { 0, }; |
1111 | unsigned long user_addr; | ||
1112 | struct buffer_head map_bh = { 0, }; | 1110 | struct buffer_head map_bh = { 0, }; |
1113 | struct blk_plug plug; | 1111 | struct blk_plug plug; |
1114 | unsigned long align = offset | iov_iter_alignment(iter); | 1112 | unsigned long align = offset | iov_iter_alignment(iter); |
@@ -1231,12 +1229,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1231 | if (unlikely(sdio.blkfactor)) | 1229 | if (unlikely(sdio.blkfactor)) |
1232 | sdio.pages_in_io = 2; | 1230 | sdio.pages_in_io = 2; |
1233 | 1231 | ||
1234 | for (seg = 0; seg < iter->nr_segs; seg++) { | 1232 | sdio.pages_in_io += iov_iter_npages(iter, INT_MAX); |
1235 | user_addr = (unsigned long)iter->iov[seg].iov_base; | ||
1236 | sdio.pages_in_io += | ||
1237 | ((user_addr + iter->iov[seg].iov_len + PAGE_SIZE-1) / | ||
1238 | PAGE_SIZE - user_addr / PAGE_SIZE); | ||
1239 | } | ||
1240 | 1233 | ||
1241 | blk_start_plug(&plug); | 1234 | blk_start_plug(&plug); |
1242 | 1235 | ||