diff options
author | Kent Overstreet <koverstreet@google.com> | 2013-05-07 19:18:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-07 21:38:29 -0400 |
commit | 0460fef2a9215680f7f85415b57731b7e0fdf673 (patch) | |
tree | a97456b0a9c6c6f66c4f22eac11d037be4c4d290 /drivers/usb | |
parent | 21b40200cfe961b1428a529c63c33b1f1e1b4738 (diff) |
aio: use cancellation list lazily
Cancelling kiocbs requires adding them to a per kioctx linked list,
which is one of the few things we need to take the kioctx lock for in
the fast path. But most kiocbs can't be cancelled - so if we just do
this lazily, we can avoid quite a bit of locking overhead.
While we're at it, instead of using a flag bit switch to using ki_cancel
itself to indicate that a kiocb has been cancelled/completed. This lets
us get rid of ki_flags entirely.
[akpm@linux-foundation.org: remove buggy BUG()]
Signed-off-by: Kent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Reviewed-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/inode.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 994e7433e87a..570c005062ab 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -533,7 +533,6 @@ static int ep_aio_cancel(struct kiocb *iocb, struct io_event *e) | |||
533 | local_irq_disable(); | 533 | local_irq_disable(); |
534 | epdata = priv->epdata; | 534 | epdata = priv->epdata; |
535 | // spin_lock(&epdata->dev->lock); | 535 | // spin_lock(&epdata->dev->lock); |
536 | kiocbSetCancelled(iocb); | ||
537 | if (likely(epdata && epdata->ep && priv->req)) | 536 | if (likely(epdata && epdata->ep && priv->req)) |
538 | value = usb_ep_dequeue (epdata->ep, priv->req); | 537 | value = usb_ep_dequeue (epdata->ep, priv->req); |
539 | else | 538 | else |
@@ -663,7 +662,7 @@ fail: | |||
663 | goto fail; | 662 | goto fail; |
664 | } | 663 | } |
665 | 664 | ||
666 | iocb->ki_cancel = ep_aio_cancel; | 665 | kiocb_set_cancel_fn(iocb, ep_aio_cancel); |
667 | get_ep(epdata); | 666 | get_ep(epdata); |
668 | priv->epdata = epdata; | 667 | priv->epdata = epdata; |
669 | priv->actual = 0; | 668 | priv->actual = 0; |