Skip to content

Commit 88cfd30

Browse files
Johannes Thumshirndjwong
authored andcommitted
iomap: remove unneeded variable in iomap_dio_rw()
The 'start' variable indicates the start of a filemap and is set to the iocb's position, which we have already cached as 'pos', upon function entry. 'pos' is used as a cursor indicating the current position and updated later in iomap_dio_rw(), but not before the last use of 'start'. Remove 'start' as it's synonym for 'pos' before we're entering the loop calling iomapp_apply(). Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent f550ee9 commit 88cfd30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/iomap/direct-io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
405405
struct address_space *mapping = iocb->ki_filp->f_mapping;
406406
struct inode *inode = file_inode(iocb->ki_filp);
407407
size_t count = iov_iter_count(iter);
408-
loff_t pos = iocb->ki_pos, start = pos;
408+
loff_t pos = iocb->ki_pos;
409409
loff_t end = iocb->ki_pos + count - 1, ret = 0;
410410
unsigned int flags = IOMAP_DIRECT;
411411
struct blk_plug plug;
@@ -461,14 +461,14 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
461461
}
462462

463463
if (iocb->ki_flags & IOCB_NOWAIT) {
464-
if (filemap_range_has_page(mapping, start, end)) {
464+
if (filemap_range_has_page(mapping, pos, end)) {
465465
ret = -EAGAIN;
466466
goto out_free_dio;
467467
}
468468
flags |= IOMAP_NOWAIT;
469469
}
470470

471-
ret = filemap_write_and_wait_range(mapping, start, end);
471+
ret = filemap_write_and_wait_range(mapping, pos, end);
472472
if (ret)
473473
goto out_free_dio;
474474

@@ -479,7 +479,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
479479
* pretty crazy thing to do, so we don't support it 100%.
480480
*/
481481
ret = invalidate_inode_pages2_range(mapping,
482-
start >> PAGE_SHIFT, end >> PAGE_SHIFT);
482+
pos >> PAGE_SHIFT, end >> PAGE_SHIFT);
483483
if (ret)
484484
dio_warn_stale_pagecache(iocb->ki_filp);
485485
ret = 0;

0 commit comments

Comments
 (0)