diff options
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 57 |
1 files changed, 5 insertions, 52 deletions
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/file.h> | 24 | #include <linux/file.h> |
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <linux/mman.h> | 26 | #include <linux/mman.h> |
27 | #include <linux/mmu_context.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
29 | #include <linux/aio.h> | 30 | #include <linux/aio.h> |
@@ -34,7 +35,6 @@ | |||
34 | 35 | ||
35 | #include <asm/kmap_types.h> | 36 | #include <asm/kmap_types.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/mmu_context.h> | ||
38 | 38 | ||
39 | #if DEBUG > 1 | 39 | #if DEBUG > 1 |
40 | #define dprintk printk | 40 | #define dprintk printk |
@@ -78,6 +78,7 @@ static int __init aio_setup(void) | |||
78 | 78 | ||
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | __initcall(aio_setup); | ||
81 | 82 | ||
82 | static void aio_free_ring(struct kioctx *ctx) | 83 | static void aio_free_ring(struct kioctx *ctx) |
83 | { | 84 | { |
@@ -380,6 +381,7 @@ ssize_t wait_on_sync_kiocb(struct kiocb *iocb) | |||
380 | __set_current_state(TASK_RUNNING); | 381 | __set_current_state(TASK_RUNNING); |
381 | return iocb->ki_user_data; | 382 | return iocb->ki_user_data; |
382 | } | 383 | } |
384 | EXPORT_SYMBOL(wait_on_sync_kiocb); | ||
383 | 385 | ||
384 | /* exit_aio: called when the last user of mm goes away. At this point, | 386 | /* exit_aio: called when the last user of mm goes away. At this point, |
385 | * there is no way for any new requests to be submited or any of the | 387 | * there is no way for any new requests to be submited or any of the |
@@ -573,6 +575,7 @@ int aio_put_req(struct kiocb *req) | |||
573 | spin_unlock_irq(&ctx->ctx_lock); | 575 | spin_unlock_irq(&ctx->ctx_lock); |
574 | return ret; | 576 | return ret; |
575 | } | 577 | } |
578 | EXPORT_SYMBOL(aio_put_req); | ||
576 | 579 | ||
577 | static struct kioctx *lookup_ioctx(unsigned long ctx_id) | 580 | static struct kioctx *lookup_ioctx(unsigned long ctx_id) |
578 | { | 581 | { |
@@ -595,51 +598,6 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) | |||
595 | } | 598 | } |
596 | 599 | ||
597 | /* | 600 | /* |
598 | * use_mm | ||
599 | * Makes the calling kernel thread take on the specified | ||
600 | * mm context. | ||
601 | * Called by the retry thread execute retries within the | ||
602 | * iocb issuer's mm context, so that copy_from/to_user | ||
603 | * operations work seamlessly for aio. | ||
604 | * (Note: this routine is intended to be called only | ||
605 | * from a kernel thread context) | ||
606 | */ | ||
607 | static void use_mm(struct mm_struct *mm) | ||
608 | { | ||
609 | struct mm_struct *active_mm; | ||
610 | struct task_struct *tsk = current; | ||
611 | |||
612 | task_lock(tsk); | ||
613 | active_mm = tsk->active_mm; | ||
614 | atomic_inc(&mm->mm_count); | ||
615 | tsk->mm = mm; | ||
616 | tsk->active_mm = mm; | ||
617 | switch_mm(active_mm, mm, tsk); | ||
618 | task_unlock(tsk); | ||
619 | |||
620 | mmdrop(active_mm); | ||
621 | } | ||
622 | |||
623 | /* | ||
624 | * unuse_mm | ||
625 | * Reverses the effect of use_mm, i.e. releases the | ||
626 | * specified mm context which was earlier taken on | ||
627 | * by the calling kernel thread | ||
628 | * (Note: this routine is intended to be called only | ||
629 | * from a kernel thread context) | ||
630 | */ | ||
631 | static void unuse_mm(struct mm_struct *mm) | ||
632 | { | ||
633 | struct task_struct *tsk = current; | ||
634 | |||
635 | task_lock(tsk); | ||
636 | tsk->mm = NULL; | ||
637 | /* active_mm is still 'mm' */ | ||
638 | enter_lazy_tlb(mm, tsk); | ||
639 | task_unlock(tsk); | ||
640 | } | ||
641 | |||
642 | /* | ||
643 | * Queue up a kiocb to be retried. Assumes that the kiocb | 601 | * Queue up a kiocb to be retried. Assumes that the kiocb |
644 | * has already been marked as kicked, and places it on | 602 | * has already been marked as kicked, and places it on |
645 | * the retry run list for the corresponding ioctx, if it | 603 | * the retry run list for the corresponding ioctx, if it |
@@ -1037,6 +995,7 @@ put_rq: | |||
1037 | spin_unlock_irqrestore(&ctx->ctx_lock, flags); | 995 | spin_unlock_irqrestore(&ctx->ctx_lock, flags); |
1038 | return ret; | 996 | return ret; |
1039 | } | 997 | } |
998 | EXPORT_SYMBOL(aio_complete); | ||
1040 | 999 | ||
1041 | /* aio_read_evt | 1000 | /* aio_read_evt |
1042 | * Pull an event off of the ioctx's event ring. Returns the number of | 1001 | * Pull an event off of the ioctx's event ring. Returns the number of |
@@ -1825,9 +1784,3 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, | |||
1825 | asmlinkage_protect(5, ret, ctx_id, min_nr, nr, events, timeout); | 1784 | asmlinkage_protect(5, ret, ctx_id, min_nr, nr, events, timeout); |
1826 | return ret; | 1785 | return ret; |
1827 | } | 1786 | } |
1828 | |||
1829 | __initcall(aio_setup); | ||
1830 | |||
1831 | EXPORT_SYMBOL(aio_complete); | ||
1832 | EXPORT_SYMBOL(aio_put_req); | ||
1833 | EXPORT_SYMBOL(wait_on_sync_kiocb); | ||