diff mbox

[RFC,2/4] aio: prefer aio_op op over iter_op

Message ID 20150311224618.23777.38330.stgit@tstruk-mobl1 (mailing list archive)
State RFC
Delegated to: Herbert Xu
Headers show

Commit Message

Tadeusz Struk March 11, 2015, 10:46 p.m. UTC
AIO interface should prefer AIO operations over iter_op

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---
 fs/aio.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Al Viro March 12, 2015, 6:48 a.m. UTC | #1
On Wed, Mar 11, 2015 at 03:46:18PM -0700, Tadeusz Struk wrote:
> AIO interface should prefer AIO operations over iter_op

What the devil for?  read_iter and write_iter *ARE* aio operations, as much
as soon to be removed aio_read and aio_write.  And yes, those are going to
be removed very soon.

Note that ->read_iter() and ->write_iter() are getting iocb pointer passed
to them.  It's just that socket instances are not passing it along to
->sendmsg/->recvmsg anymore.

And why, in name of everything unholy, do your methods get redundant
total_len argument?  It's iov_iter_count(&msg->msg_iter) (and in iov_iter-net
I have an inline helper doing that - enough places open-coding that thing).
If nothing else, ->sendmsg() and ->recvmsg() would benefit from removing
that argument as well.  I have patches doing that, but iocb removal conflicts
with them and they need to be rebased to current net/master...
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tadeusz Struk March 12, 2015, 2 p.m. UTC | #2
On 03/11/2015 11:48 PM, Al Viro wrote:
>> AIO interface should prefer AIO operations over iter_op
> What the devil for?  read_iter and write_iter *ARE* aio operations, as much
> as soon to be removed aio_read and aio_write.  And yes, those are going to
> be removed very soon.

That's fine. When those will get removed, then as part of the cleanup we can 
merge sock_read_iter() with sock_aio_read() and sock_write_iter()
with sock_aio_write() and call sock_recvmsg()/sock_sendmsg() or 
sock->ops->aio_recvmsg()/sock->ops->aio_sendmsg based on if (is_sync_kiocb(iocb))

> 
> Note that ->read_iter() and ->write_iter() are getting iocb pointer passed
> to them.  It's just that socket instances are not passing it along to
> ->sendmsg/->recvmsg anymore.

and that's the main reason why I have added the sock_aio_read() and sock_aio_write()
I didn't want to mess with the sock_read_iter() and sock_write_iter() for now.

> 
> And why, in name of everything unholy, do your methods get redundant
> total_len argument?  It's iov_iter_count(&msg->msg_iter) (and in iov_iter-net
> I have an inline helper doing that - enough places open-coding that thing).
> If nothing else, ->sendmsg() and ->recvmsg() would benefit from removing
> that argument as well.  I have patches doing that, but iocb removal conflicts
> with them and they need to be rebased to current net/master...

You are right, it's not needed at all. I took the signatures from sendmsg() and
recvmsg() and just added iocb. I will remove them in v2 if you want, or you can
add it to your patches.
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/aio.c b/fs/aio.c
index f8e52a1..389f4dd 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1449,11 +1449,15 @@  rw_common:
 		if (rw == WRITE)
 			file_start_write(file);
 
-		if (iter_op) {
+		if (rw_op) {
+			ret = rw_op(req, iovec, nr_segs, req->ki_pos);
+		} else if (iter_op) {
 			iov_iter_init(&iter, rw, iovec, nr_segs, req->ki_nbytes);
 			ret = iter_op(req, &iter);
 		} else {
-			ret = rw_op(req, iovec, nr_segs, req->ki_pos);
+			if (iovec != inline_vecs)
+				kfree(iovec);
+			return -EINVAL;
 		}
 
 		if (rw == WRITE)