From: Christoph Hellwig <hch@lst.de>
To: viro@zeniv.linux.org.uk, axboe@kernel.dk
Cc: Milosz Tanski <milosz@adfin.com>,
Goldwyn Rodrigues <rgoldwyn@suse.com>,
mgorman@suse.de, Volker.Lendecke@sernet.de,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org
Subject: [PATCH 1/4] fs: pass iocb to do_generic_file_read
Date: Tue, 29 Aug 2017 16:13:18 +0200 [thread overview]
Message-ID: <20170829141321.4482-2-hch@lst.de> (raw)
In-Reply-To: <20170829141321.4482-1-hch@lst.de>
And rename it to the more descriptive generic_file_buffered_read while
at it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
---
mm/filemap.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index a49702445ce0..4bcfa74ad802 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1886,9 +1886,8 @@ static void shrink_readahead_size_eio(struct file *filp,
}
/**
- * do_generic_file_read - generic file read routine
- * @filp: the file to read
- * @ppos: current file position
+ * generic_file_buffered_read - generic file read routine
+ * @iocb: the iocb to read
* @iter: data destination
* @written: already copied
*
@@ -1898,12 +1897,14 @@ static void shrink_readahead_size_eio(struct file *filp,
* This is really ugly. But the goto's actually try to clarify some
* of the logic when it comes to error handling etc.
*/
-static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos,
+static ssize_t generic_file_buffered_read(struct kiocb *iocb,
struct iov_iter *iter, ssize_t written)
{
+ struct file *filp = iocb->ki_filp;
struct address_space *mapping = filp->f_mapping;
struct inode *inode = mapping->host;
struct file_ra_state *ra = &filp->f_ra;
+ loff_t *ppos = &iocb->ki_pos;
pgoff_t index;
pgoff_t last_index;
pgoff_t prev_index;
@@ -2151,14 +2152,14 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos,
ssize_t
generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
{
- struct file *file = iocb->ki_filp;
- ssize_t retval = 0;
size_t count = iov_iter_count(iter);
+ ssize_t retval = 0;
if (!count)
goto out; /* skip atime */
if (iocb->ki_flags & IOCB_DIRECT) {
+ struct file *file = iocb->ki_filp;
struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host;
loff_t size;
@@ -2199,7 +2200,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
goto out;
}
- retval = do_generic_file_read(file, &iocb->ki_pos, iter, retval);
+ retval = generic_file_buffered_read(iocb, iter, retval);
out:
return retval;
}
--
2.11.0
next prev parent reply other threads:[~2017-08-29 14:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 14:13 non-blocking buffered reads V5 Christoph Hellwig
2017-08-29 14:13 ` Christoph Hellwig [this message]
2017-08-29 14:13 ` [PATCH 2/4] fs: support IOCB_NOWAIT in generic_file_buffered_read Christoph Hellwig
2017-09-04 12:47 ` Jan Kara
2017-08-29 14:13 ` [PATCH 3/4] fs: support RWF_NOWAIT for buffered reads Christoph Hellwig
2017-08-29 14:13 ` [PATCH 4/4] block_dev: support RFW_NOWAIT on block device nodes Christoph Hellwig
2017-09-01 8:13 ` non-blocking buffered reads V5 Christoph Hellwig
2017-09-01 14:58 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2017-08-22 16:17 non-blocking buffered reads V4 Christoph Hellwig
2017-08-22 16:17 ` [PATCH 1/4] fs: pass iocb to do_generic_file_read Christoph Hellwig
2017-08-24 14:23 ` Jan Kara
2017-07-06 15:30 non-blockling buffered reads V3 Christoph Hellwig
2017-07-06 15:30 ` [PATCH 1/4] fs: pass iocb to do_generic_file_read Christoph Hellwig
2017-07-07 10:08 ` Mel Gorman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170829141321.4482-2-hch@lst.de \
--to=hch@lst.de \
--cc=Volker.Lendecke@sernet.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=milosz@adfin.com \
--cc=rgoldwyn@suse.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).