[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210122160140.223228-19-willy@infradead.org>
Date: Fri, 22 Jan 2021 16:01:40 +0000
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Christoph Hellwig <hch@....de>, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Matthew Wilcox <willy@...radead.org>,
Kent Overstreet <kent.overstreet@...il.com>
Subject: [PATCH v5 18/18] mm/filemap: Simplify generic_file_read_iter
From: Christoph Hellwig <hch@....de>
Avoid the pointless goto out just for returning retval.
Signed-off-by: Christoph Hellwig <hch@....de>
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Reviewed-by: Kent Overstreet <kent.overstreet@...il.com>
---
mm/filemap.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index ef910eca9e1a2..f5903494cf173 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2555,7 +2555,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
ssize_t retval = 0;
if (!count)
- goto out; /* skip atime */
+ return 0; /* skip atime */
if (iocb->ki_flags & IOCB_DIRECT) {
struct file *file = iocb->ki_filp;
@@ -2573,7 +2573,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
iocb->ki_pos,
iocb->ki_pos + count - 1);
if (retval < 0)
- goto out;
+ return retval;
}
file_accessed(file);
@@ -2597,12 +2597,10 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
*/
if (retval < 0 || !count || iocb->ki_pos >= size ||
IS_DAX(inode))
- goto out;
+ return retval;
}
- retval = filemap_read(iocb, iter, retval);
-out:
- return retval;
+ return filemap_read(iocb, iter, retval);
}
EXPORT_SYMBOL(generic_file_read_iter);
--
2.29.2
Powered by blists - more mailing lists