Commit 1c0ff0f1 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Linus Torvalds

fs/direct-io.c: minor cleanups in do_blockdev_direct_IO

We already get the block counts and calculate the end block at the
beginning of the function.  Let's use the local variables for
consistency and readability.  No functional changes

[akpm@linux-foundation.org: constify the locals to prevent future slipups]
Link: http://lkml.kernel.org/r/1519638870-17756-1-git-send-email-nborisov@suse.comSigned-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5844a486
...@@ -1178,9 +1178,9 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, ...@@ -1178,9 +1178,9 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
unsigned blkbits = i_blkbits; unsigned blkbits = i_blkbits;
unsigned blocksize_mask = (1 << blkbits) - 1; unsigned blocksize_mask = (1 << blkbits) - 1;
ssize_t retval = -EINVAL; ssize_t retval = -EINVAL;
size_t count = iov_iter_count(iter); const size_t count = iov_iter_count(iter);
loff_t offset = iocb->ki_pos; loff_t offset = iocb->ki_pos;
loff_t end = offset + count; const loff_t end = offset + count;
struct dio *dio; struct dio *dio;
struct dio_submit sdio = { 0, }; struct dio_submit sdio = { 0, };
struct buffer_head map_bh = { 0, }; struct buffer_head map_bh = { 0, };
...@@ -1201,7 +1201,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, ...@@ -1201,7 +1201,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
} }
/* watch out for a 0 len io from a tricksy fs */ /* watch out for a 0 len io from a tricksy fs */
if (iov_iter_rw(iter) == READ && !iov_iter_count(iter)) if (iov_iter_rw(iter) == READ && !count)
return 0; return 0;
dio = kmem_cache_alloc(dio_cache, GFP_KERNEL); dio = kmem_cache_alloc(dio_cache, GFP_KERNEL);
...@@ -1318,8 +1318,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, ...@@ -1318,8 +1318,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
dio->should_dirty = (iter->type == ITER_IOVEC); dio->should_dirty = (iter->type == ITER_IOVEC);
sdio.iter = iter; sdio.iter = iter;
sdio.final_block_in_request = sdio.final_block_in_request = end >> blkbits;
(offset + iov_iter_count(iter)) >> blkbits;
/* /*
* In case of non-aligned buffers, we may need 2 more * In case of non-aligned buffers, we may need 2 more
......
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