@@ -671,7 +671,7 @@ static void ffs_user_copy_worker(struct work_struct *work)
unuse_mm(io_data->mm);
}
- aio_complete(io_data->kiocb, ret, ret);
+ aio_complete(io_data->kiocb, ret);
usb_ep_free_request(io_data->ep, io_data->req);
@@ -582,7 +582,7 @@ static void ep_user_copy_worker(struct work_struct *work)
unuse_mm(mm);
/* completing the iocb can drop the ctx and mm, don't touch mm after */
- aio_complete(iocb, ret, ret);
+ aio_complete(iocb, ret);
kfree(priv->buf);
kfree(priv);
@@ -608,8 +608,7 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
kfree(priv);
iocb->private = NULL;
/* aio_complete() reports bytes-transferred _and_ faults */
- aio_complete(iocb, req->actual ? req->actual : req->status,
- req->status);
+ aio_complete(iocb, req->actual ? req->actual : req->status);
} else {
/* ep_copy_to_user() won't report both; we hide some faults */
if (unlikely(0 != req->status))
@@ -1007,7 +1007,7 @@ out:
/* aio_complete
* Called when the io request on the given iocb is complete.
*/
-void aio_complete(struct kiocb *iocb, long res, long res2)
+void aio_complete(struct kiocb *iocb, ssize_t res)
{
struct kioctx *ctx = iocb->ki_ctx;
struct aio_ring *ring;
@@ -1051,14 +1051,13 @@ void aio_complete(struct kiocb *iocb, long res, long res2)
event->obj = (u64)(unsigned long)iocb->ki_obj.user;
event->data = iocb->ki_user_data;
event->res = res;
- event->res2 = res2;
+ event->res2 = 0;
kunmap_atomic(ev_page);
flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
- pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n",
- ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
- res, res2);
+ pr_debug("%p[%u]: %p: %p %Lx %zx\n",
+ ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data, res);
/* after flagging the request as done, we
* must never even look at it again
@@ -1475,7 +1474,7 @@ rw_common:
ret == -ERESTARTNOHAND ||
ret == -ERESTART_RESTARTBLOCK))
ret = -EINTR;
- aio_complete(req, ret, 0);
+ aio_complete(req, ret);
}
return 0;
@@ -265,7 +265,7 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret,
ret = err;
}
- aio_complete(dio->iocb, ret, 0);
+ aio_complete(dio->iocb, ret);
}
kmem_cache_free(dio_cache, dio);
@@ -578,7 +578,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
}
}
- aio_complete(io->iocb, res, 0);
+ aio_complete(io->iocb, res);
kfree(io);
}
}
@@ -330,10 +330,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
inode_dio_done(inode);
if (dreq->iocb) {
- long res = (long) dreq->error;
- if (!res)
- res = (long) dreq->count;
- aio_complete(dreq->iocb, res, 0);
+ aio_complete(dreq->iocb,
+ dreq->error ? dreq->error : dreq->count);
}
complete_all(&dreq->completion);
@@ -68,14 +68,14 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
/* prototypes */
#ifdef CONFIG_AIO
-extern void aio_complete(struct kiocb *iocb, long res, long res2);
+extern void aio_complete(struct kiocb *iocb, ssize_t ret);
struct mm_struct;
extern void exit_aio(struct mm_struct *mm);
extern long do_io_submit(aio_context_t ctx_id, long nr,
struct iocb __user *__user *iocbpp, bool compat);
void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
#else
-static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
+static inline void aio_complete(struct kiocb *iocb, ssize_t ret) { }
struct mm_struct;
static inline void exit_aio(struct mm_struct *mm) { }
static inline long do_io_submit(aio_context_t ctx_id, long nr,
Pass the result as a ssize_t, which is what we use for these returns all over the kernel. Remove the res2 argument that all relevant callers always pass as '0'. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/usb/gadget/function/f_fs.c | 2 +- drivers/usb/gadget/legacy/inode.c | 5 ++--- fs/aio.c | 11 +++++------ fs/direct-io.c | 2 +- fs/fuse/file.c | 2 +- fs/nfs/direct.c | 6 ++---- include/linux/aio.h | 4 ++-- 7 files changed, 14 insertions(+), 18 deletions(-)