lkml.org 
[lkml]   [2013]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectlinux-next: manual merge of the akpm tree with the aio-direct tree
Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in mm/filemap.c
between dropping the aio-direct tree and commit "mm: drop actor argument
of do_generic_file_read()" from the akpm tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required). The followup fix up patch is no longer (for
now) needed.

(This is part of the pain of maintaining a rebasing patch series on top
of linux-next.)

The patch now looks like this:

diff --git a/mm/filemap.c b/mm/filemap.c
index ae4846ff4849..b7749a92021c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1090,7 +1090,6 @@ static void shrink_readahead_size_eio(struct file *filp,
* @filp: the file to read
* @ppos: current file position
* @desc: read_descriptor
- * @actor: read method
*
* This is a generic file read routine, and uses the
* mapping->a_ops->readpage() function for the actual low-level stuff.
@@ -1099,7 +1098,7 @@ static void shrink_readahead_size_eio(struct file *filp,
* of the logic when it comes to error handling etc.
*/
static void do_generic_file_read(struct file *filp, loff_t *ppos,
- read_descriptor_t *desc, read_actor_t actor)
+ read_descriptor_t *desc)
{
struct address_space *mapping = filp->f_mapping;
struct inode *inode = mapping->host;
@@ -1200,13 +1199,14 @@ page_ok:
* Ok, we have the page, and it's up-to-date, so
* now we can copy it to user space...
*
- * The actor routine returns how many bytes were actually used..
+ * The file_read_actor routine returns how many bytes were
+ * actually used..
* NOTE! This may not be the same as how much of a user buffer
* we filled up (we may be padding etc), so we can only update
* "pos" here (the actor routine has to update the user buffer
* pointers and the remaining count).
*/
- ret = actor(desc, page, offset, nr);
+ ret = file_read_actor(desc, page, offset, nr);
offset += ret;
index += offset >> PAGE_CACHE_SHIFT;
offset &= ~PAGE_CACHE_MASK;
@@ -1479,7 +1479,7 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
if (desc.count == 0)
continue;
desc.error = 0;
- do_generic_file_read(filp, ppos, &desc, file_read_actor);
+ do_generic_file_read(filp, ppos, &desc);
retval += desc.written;
if (desc.error) {
retval = retval ?: desc.error;
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au

diff --cc mm/filemap.c
index ae4846ff4849,9cb5b0dea852..000000000000
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@@ -1455,41 -1426,46 +1455,41 @@@ generic_file_aio_read(struct kiocb *ioc
}
}
- desc.written = 0;
- desc.arg.data = iter;
- desc.count = count;
- desc.error = 0;
- do_generic_file_read(filp, ppos, &desc);
- if (desc.written)
- retval = desc.written;
- else
- retval = desc.error;
-out:
- return retval;
-}
-EXPORT_SYMBOL(generic_file_read_iter);
+ count = retval;
+ for (seg = 0; seg < nr_segs; seg++) {
+ read_descriptor_t desc;
+ loff_t offset = 0;
-/**
- * generic_file_aio_read - generic filesystem read routine
- * @iocb: kernel I/O control block
- * @iov: io vector request
- * @nr_segs: number of segments in the iovec
- * @pos: current file position
- *
- * This is the "read()" routine for all filesystems
- * that can use the page cache directly.
- */
-ssize_t
-generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
- unsigned long nr_segs, loff_t pos)
-{
- struct iov_iter iter;
- int ret;
- size_t count;
-
- count = 0;
- ret = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
- if (ret)
- return ret;
-
- iov_iter_init(&iter, iov, nr_segs, count, 0);
+ /*
+ * If we did a short DIO read we need to skip the section of the
+ * iov that we've already read data into.
+ */
+ if (count) {
+ if (count > iov[seg].iov_len) {
+ count -= iov[seg].iov_len;
+ continue;
+ }
+ offset = count;
+ count = 0;
+ }
- return generic_file_read_iter(iocb, &iter, pos);
+ desc.written = 0;
+ desc.arg.buf = iov[seg].iov_base + offset;
+ desc.count = iov[seg].iov_len - offset;
+ if (desc.count == 0)
+ continue;
+ desc.error = 0;
- do_generic_file_read(filp, ppos, &desc, file_read_actor);
++ do_generic_file_read(filp, ppos, &desc);
+ retval += desc.written;
+ if (desc.error) {
+ retval = retval ?: desc.error;
+ break;
+ }
+ if (desc.count > 0)
+ break;
+ }
+out:
+ return retval;
}
EXPORT_SYMBOL(generic_file_aio_read);
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-11-08 09:41    [W:0.770 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site