linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw()
@ 2019-11-26 12:20 Johannes Thumshirn
  2019-11-26 16:21 ` Christoph Hellwig
  2019-11-26 17:47 ` Darrick J. Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2019-11-26 12:20 UTC (permalink / raw)
  To: Christoph Hellwig, Darrick J . Wong; +Cc: linux-fsdevel, Johannes Thumshirn

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 <jthumshirn@suse.de>
---
 fs/iomap/direct-io.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 1fc28c2da279..405456b12f03 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -397,7 +397,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	struct address_space *mapping = iocb->ki_filp->f_mapping;
 	struct inode *inode = file_inode(iocb->ki_filp);
 	size_t count = iov_iter_count(iter);
-	loff_t pos = iocb->ki_pos, start = pos;
+	loff_t pos = iocb->ki_pos;
 	loff_t end = iocb->ki_pos + count - 1, ret = 0;
 	unsigned int flags = IOMAP_DIRECT;
 	bool wait_for_completion = is_sync_kiocb(iocb);
@@ -451,14 +451,14 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	}
 
 	if (iocb->ki_flags & IOCB_NOWAIT) {
-		if (filemap_range_has_page(mapping, start, end)) {
+		if (filemap_range_has_page(mapping, pos, end)) {
 			ret = -EAGAIN;
 			goto out_free_dio;
 		}
 		flags |= IOMAP_NOWAIT;
 	}
 
-	ret = filemap_write_and_wait_range(mapping, start, end);
+	ret = filemap_write_and_wait_range(mapping, pos, end);
 	if (ret)
 		goto out_free_dio;
 
@@ -469,7 +469,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
 	 * pretty crazy thing to do, so we don't support it 100%.
 	 */
 	ret = invalidate_inode_pages2_range(mapping,
-			start >> PAGE_SHIFT, end >> PAGE_SHIFT);
+			pos >> PAGE_SHIFT, end >> PAGE_SHIFT);
 	if (ret)
 		dio_warn_stale_pagecache(iocb->ki_filp);
 	ret = 0;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw()
  2019-11-26 12:20 [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw() Johannes Thumshirn
@ 2019-11-26 16:21 ` Christoph Hellwig
  2019-11-26 17:47 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-11-26 16:21 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Christoph Hellwig, Darrick J . Wong, linux-fsdevel

On Tue, Nov 26, 2019 at 01:20:51PM +0100, Johannes Thumshirn wrote:
> 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 <jthumshirn@suse.de>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw()
  2019-11-26 12:20 [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw() Johannes Thumshirn
  2019-11-26 16:21 ` Christoph Hellwig
@ 2019-11-26 17:47 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2019-11-26 17:47 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Christoph Hellwig, linux-fsdevel

On Tue, Nov 26, 2019 at 01:20:51PM +0100, Johannes Thumshirn wrote:
> 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 <jthumshirn@suse.de>

Looks good to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/iomap/direct-io.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
> index 1fc28c2da279..405456b12f03 100644
> --- a/fs/iomap/direct-io.c
> +++ b/fs/iomap/direct-io.c
> @@ -397,7 +397,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>  	struct address_space *mapping = iocb->ki_filp->f_mapping;
>  	struct inode *inode = file_inode(iocb->ki_filp);
>  	size_t count = iov_iter_count(iter);
> -	loff_t pos = iocb->ki_pos, start = pos;
> +	loff_t pos = iocb->ki_pos;
>  	loff_t end = iocb->ki_pos + count - 1, ret = 0;
>  	unsigned int flags = IOMAP_DIRECT;
>  	bool wait_for_completion = is_sync_kiocb(iocb);
> @@ -451,14 +451,14 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>  	}
>  
>  	if (iocb->ki_flags & IOCB_NOWAIT) {
> -		if (filemap_range_has_page(mapping, start, end)) {
> +		if (filemap_range_has_page(mapping, pos, end)) {
>  			ret = -EAGAIN;
>  			goto out_free_dio;
>  		}
>  		flags |= IOMAP_NOWAIT;
>  	}
>  
> -	ret = filemap_write_and_wait_range(mapping, start, end);
> +	ret = filemap_write_and_wait_range(mapping, pos, end);
>  	if (ret)
>  		goto out_free_dio;
>  
> @@ -469,7 +469,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
>  	 * pretty crazy thing to do, so we don't support it 100%.
>  	 */
>  	ret = invalidate_inode_pages2_range(mapping,
> -			start >> PAGE_SHIFT, end >> PAGE_SHIFT);
> +			pos >> PAGE_SHIFT, end >> PAGE_SHIFT);
>  	if (ret)
>  		dio_warn_stale_pagecache(iocb->ki_filp);
>  	ret = 0;
> -- 
> 2.16.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-26 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 12:20 [PATCH TRIVIAL] iomap: remove unneeded variable in iomap_dio_rw() Johannes Thumshirn
2019-11-26 16:21 ` Christoph Hellwig
2019-11-26 17:47 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).