linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] aio updates
@ 2002-10-15  1:17 John Myers
  2002-10-15 19:57 ` Benjamin LaHaise
  0 siblings, 1 reply; 6+ messages in thread
From: John Myers @ 2002-10-15  1:17 UTC (permalink / raw)
  To: linux-aio, linux-kernel, torvalds

Please apply.

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.850   -> 1.851  
#	            fs/aio.c	1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/14	jgmyers@netscape.com	1.851
# aio updates
#     fix uninitialized variable causing incorrect timeout
#     add support for IO_CMD_NOOP
#     make sys_io_cancel(), not cancel method, initialize most of returned result
#     minor aio_cancel_all() optimization
#     fix a debug printk
# --------------------------------------------
#
diff -Nru a/fs/aio.c b/fs/aio.c
--- a/fs/aio.c	Mon Oct 14 16:51:45 2002
+++ b/fs/aio.c	Mon Oct 14 16:51:45 2002
@@ -248,7 +248,7 @@
 	write_unlock(&mm->ioctx_list_lock);
 
 	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;
 
 out_cleanup:
@@ -281,12 +281,12 @@
 		struct kiocb *iocb = list_kiocb(pos);
 		list_del_init(&iocb->ki_list);
 		cancel = iocb->ki_cancel;
-		if (cancel)
+		if (cancel) {
 			iocb->ki_users++;
-		spin_unlock_irq(&ctx->ctx_lock);
-		if (cancel)
+			spin_unlock_irq(&ctx->ctx_lock);
 			cancel(iocb, &res);
-		spin_lock_irq(&ctx->ctx_lock);
+			spin_lock_irq(&ctx->ctx_lock);
+		}
 	}
 	spin_unlock_irq(&ctx->ctx_lock);
 }
@@ -845,13 +845,13 @@
 
 	/* End fast path */
 
+	init_timeout(&to);
 	if (timeout) {
 		struct timespec	ts;
 		ret = -EFAULT;
 		if (unlikely(copy_from_user(&ts, timeout, sizeof(ts))))
 			goto out;
 
-		init_timeout(&to);
 		set_timeout(start_jiffies, &to, &ts);
 	}
 
@@ -1073,6 +1073,9 @@
 		if (file->f_op->aio_fsync)
 			ret = file->f_op->aio_fsync(req, 0);
 		break;
+	case IOCB_CMD_NOOP:
+		aio_complete(req, iocb->aio_buf, iocb->aio_offset);
+		return 0;
 	default:
 		dprintk("EINVAL: io_submit: no operation provided\n");
 		ret = -EINVAL;
@@ -1197,6 +1200,9 @@
 	if (NULL != cancel) {
 		struct io_event tmp;
 		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);
 		if (!ret) {
 			/* Cancellation succeeded -- copy the result

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-15 22:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15  1:17 [PATCH] aio updates John Myers
2002-10-15 19:57 ` Benjamin LaHaise
2002-10-15 20:50   ` John Gardiner Myers
2002-10-15 21:31     ` Benjamin LaHaise
2002-10-15 22:05       ` John Gardiner Myers
2002-10-15 22:08       ` John Gardiner Myers

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).