Commit f7f05f6a authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/home/bcrl/aio-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 9af95a10 6df3d8b6
...@@ -248,7 +248,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) ...@@ -248,7 +248,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
write_unlock(&mm->ioctx_list_lock); write_unlock(&mm->ioctx_list_lock);
dprintk("aio: allocated ioctx %p[%ld]: mm=%p mask=0x%x\n", dprintk("aio: allocated ioctx %p[%ld]: mm=%p mask=0x%x\n",
ctx, ctx->user_id, current->mm, ctx->ring_info.ring->nr); ctx, ctx->user_id, current->mm, ctx->ring_info.nr);
return ctx; return ctx;
out_cleanup: out_cleanup:
...@@ -281,12 +281,12 @@ static void aio_cancel_all(struct kioctx *ctx) ...@@ -281,12 +281,12 @@ static void aio_cancel_all(struct kioctx *ctx)
struct kiocb *iocb = list_kiocb(pos); struct kiocb *iocb = list_kiocb(pos);
list_del_init(&iocb->ki_list); list_del_init(&iocb->ki_list);
cancel = iocb->ki_cancel; cancel = iocb->ki_cancel;
if (cancel) if (cancel) {
iocb->ki_users++; iocb->ki_users++;
spin_unlock_irq(&ctx->ctx_lock); spin_unlock_irq(&ctx->ctx_lock);
if (cancel)
cancel(iocb, &res); cancel(iocb, &res);
spin_lock_irq(&ctx->ctx_lock); spin_lock_irq(&ctx->ctx_lock);
}
} }
spin_unlock_irq(&ctx->ctx_lock); spin_unlock_irq(&ctx->ctx_lock);
} }
...@@ -376,7 +376,7 @@ void __put_ioctx(struct kioctx *ctx) ...@@ -376,7 +376,7 @@ void __put_ioctx(struct kioctx *ctx)
/* aio_get_req /* aio_get_req
* Allocate a slot for an aio request. Increments the users count * Allocate a slot for an aio request. Increments the users count
* of the kioctx so that the kioctx stays around until all requests are * of the kioctx so that the kioctx stays around until all requests are
* complete. Returns -EAGAIN if no requests are free. * complete. Returns NULL if no requests are free.
*/ */
static struct kiocb *FASTCALL(__aio_get_req(struct kioctx *ctx)); static struct kiocb *FASTCALL(__aio_get_req(struct kioctx *ctx));
static struct kiocb *__aio_get_req(struct kioctx *ctx) static struct kiocb *__aio_get_req(struct kioctx *ctx)
...@@ -409,8 +409,6 @@ static struct kiocb *__aio_get_req(struct kioctx *ctx) ...@@ -409,8 +409,6 @@ static struct kiocb *__aio_get_req(struct kioctx *ctx)
req->ki_user_obj = NULL; req->ki_user_obj = NULL;
req->ki_ctx = ctx; req->ki_ctx = ctx;
req->ki_users = 1; req->ki_users = 1;
} else {
kmem_cache_free(kiocb_cachep, req);
okay = 1; okay = 1;
} }
kunmap_atomic(ring, KM_USER0); kunmap_atomic(ring, KM_USER0);
...@@ -478,7 +476,7 @@ static void aio_fput_routine(void *data) ...@@ -478,7 +476,7 @@ static void aio_fput_routine(void *data)
/* __aio_put_req /* __aio_put_req
* Returns true if this put was the last user of the request. * Returns true if this put was the last user of the request.
*/ */
static inline int __aio_put_req(struct kioctx *ctx, struct kiocb *req) static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
{ {
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n", dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
req, atomic_read(&req->ki_filp->f_count)); req, atomic_read(&req->ki_filp->f_count));
...@@ -525,7 +523,7 @@ int aio_put_req(struct kiocb *req) ...@@ -525,7 +523,7 @@ int aio_put_req(struct kiocb *req)
/* Lookup an ioctx id. ioctx_list is lockless for reads. /* Lookup an ioctx id. ioctx_list is lockless for reads.
* FIXME: this is O(n) and is only suitable for development. * FIXME: this is O(n) and is only suitable for development.
*/ */
static inline struct kioctx *lookup_ioctx(unsigned long ctx_id) static struct kioctx *lookup_ioctx(unsigned long ctx_id)
{ {
struct kioctx *ioctx; struct kioctx *ioctx;
struct mm_struct *mm; struct mm_struct *mm;
...@@ -845,13 +843,13 @@ static int read_events(struct kioctx *ctx, ...@@ -845,13 +843,13 @@ static int read_events(struct kioctx *ctx,
/* End fast path */ /* End fast path */
init_timeout(&to);
if (timeout) { if (timeout) {
struct timespec ts; struct timespec ts;
ret = -EFAULT; ret = -EFAULT;
if (unlikely(copy_from_user(&ts, timeout, sizeof(ts)))) if (unlikely(copy_from_user(&ts, timeout, sizeof(ts))))
goto out; goto out;
init_timeout(&to);
set_timeout(start_jiffies, &to, &ts); set_timeout(start_jiffies, &to, &ts);
} }
...@@ -1197,6 +1195,9 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb *iocb, ...@@ -1197,6 +1195,9 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb *iocb,
if (NULL != cancel) { if (NULL != cancel) {
struct io_event tmp; struct io_event tmp;
printk("calling cancel\n"); printk("calling cancel\n");
memset(&tmp, 0, sizeof(tmp));
tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj;
tmp.data = kiocb->ki_user_data;
ret = cancel(kiocb, &tmp); ret = cancel(kiocb, &tmp);
if (!ret) { if (!ret) {
/* Cancellation succeeded -- copy the result /* Cancellation succeeded -- copy the result
......
...@@ -891,6 +891,7 @@ generic_file_aio_read(struct kiocb *iocb, char *buf, size_t count, loff_t pos) ...@@ -891,6 +891,7 @@ generic_file_aio_read(struct kiocb *iocb, char *buf, size_t count, loff_t pos)
BUG_ON(iocb->ki_pos != pos); BUG_ON(iocb->ki_pos != pos);
return __generic_file_aio_read(iocb, &local_iov, 1, &iocb->ki_pos); return __generic_file_aio_read(iocb, &local_iov, 1, &iocb->ki_pos);
} }
EXPORT_SYMBOL(generic_file_aio_read);
ssize_t ssize_t
generic_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos) generic_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
...@@ -1650,6 +1651,7 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const char *buf, ...@@ -1650,6 +1651,7 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const char *buf,
{ {
return generic_file_write(iocb->ki_filp, buf, count, &iocb->ki_pos); return generic_file_write(iocb->ki_filp, buf, count, &iocb->ki_pos);
} }
EXPORT_SYMBOL(generic_file_aio_write);
ssize_t generic_file_write(struct file *file, const char *buf, ssize_t generic_file_write(struct file *file, const char *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment