aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/aio.c40
-rw-r--r--include/linux/aio.h4
2 files changed, 2 insertions, 42 deletions
diff --git a/fs/aio.c b/fs/aio.c
index c30dfc006108..1cf12b3dd83a 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -711,10 +711,8 @@ static ssize_t aio_run_iocb(struct kiocb *iocb)
711 */ 711 */
712 ret = retry(iocb); 712 ret = retry(iocb);
713 713
714 if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) { 714 if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED)
715 BUG_ON(!list_empty(&iocb->ki_wait.task_list));
716 aio_complete(iocb, ret, 0); 715 aio_complete(iocb, ret, 0);
717 }
718out: 716out:
719 spin_lock_irq(&ctx->ctx_lock); 717 spin_lock_irq(&ctx->ctx_lock);
720 718
@@ -866,13 +864,6 @@ static void try_queue_kicked_iocb(struct kiocb *iocb)
866 unsigned long flags; 864 unsigned long flags;
867 int run = 0; 865 int run = 0;
868 866
869 /* We're supposed to be the only path putting the iocb back on the run
870 * list. If we find that the iocb is *back* on a wait queue already
871 * than retry has happened before we could queue the iocb. This also
872 * means that the retry could have completed and freed our iocb, no
873 * good. */
874 BUG_ON((!list_empty(&iocb->ki_wait.task_list)));
875
876 spin_lock_irqsave(&ctx->ctx_lock, flags); 867 spin_lock_irqsave(&ctx->ctx_lock, flags);
877 /* set this inside the lock so that we can't race with aio_run_iocb() 868 /* set this inside the lock so that we can't race with aio_run_iocb()
878 * testing it and putting the iocb on the run list under the lock */ 869 * testing it and putting the iocb on the run list under the lock */
@@ -886,7 +877,7 @@ static void try_queue_kicked_iocb(struct kiocb *iocb)
886/* 877/*
887 * kick_iocb: 878 * kick_iocb:
888 * Called typically from a wait queue callback context 879 * Called typically from a wait queue callback context
889 * (aio_wake_function) to trigger a retry of the iocb. 880 * to trigger a retry of the iocb.
890 * The retry is usually executed by aio workqueue 881 * The retry is usually executed by aio workqueue
891 * threads (See aio_kick_handler). 882 * threads (See aio_kick_handler).
892 */ 883 */
@@ -1520,31 +1511,6 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb)
1520 return 0; 1511 return 0;
1521} 1512}
1522 1513
1523/*
1524 * aio_wake_function:
1525 * wait queue callback function for aio notification,
1526 * Simply triggers a retry of the operation via kick_iocb.
1527 *
1528 * This callback is specified in the wait queue entry in
1529 * a kiocb.
1530 *
1531 * Note:
1532 * This routine is executed with the wait queue lock held.
1533 * Since kick_iocb acquires iocb->ctx->ctx_lock, it nests
1534 * the ioctx lock inside the wait queue lock. This is safe
1535 * because this callback isn't used for wait queues which
1536 * are nested inside ioctx lock (i.e. ctx->wait)
1537 */
1538static int aio_wake_function(wait_queue_t *wait, unsigned mode,
1539 int sync, void *key)
1540{
1541 struct kiocb *iocb = container_of(wait, struct kiocb, ki_wait);
1542
1543 list_del_init(&wait->task_list);
1544 kick_iocb(iocb);
1545 return 1;
1546}
1547
1548static void aio_batch_add(struct address_space *mapping, 1514static void aio_batch_add(struct address_space *mapping,
1549 struct hlist_head *batch_hash) 1515 struct hlist_head *batch_hash)
1550{ 1516{
@@ -1642,8 +1608,6 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
1642 req->ki_buf = (char __user *)(unsigned long)iocb->aio_buf; 1608 req->ki_buf = (char __user *)(unsigned long)iocb->aio_buf;
1643 req->ki_left = req->ki_nbytes = iocb->aio_nbytes; 1609 req->ki_left = req->ki_nbytes = iocb->aio_nbytes;
1644 req->ki_opcode = iocb->aio_lio_opcode; 1610 req->ki_opcode = iocb->aio_lio_opcode;
1645 init_waitqueue_func_entry(&req->ki_wait, aio_wake_function);
1646 INIT_LIST_HEAD(&req->ki_wait.task_list);
1647 1611
1648 ret = aio_setup_iocb(req); 1612 ret = aio_setup_iocb(req);
1649 1613
diff --git a/include/linux/aio.h b/include/linux/aio.h
index aea219d7d8d1..811dbb369379 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -102,7 +102,6 @@ struct kiocb {
102 } ki_obj; 102 } ki_obj;
103 103
104 __u64 ki_user_data; /* user's data for completion */ 104 __u64 ki_user_data; /* user's data for completion */
105 wait_queue_t ki_wait;
106 loff_t ki_pos; 105 loff_t ki_pos;
107 106
108 void *private; 107 void *private;
@@ -140,7 +139,6 @@ struct kiocb {
140 (x)->ki_dtor = NULL; \ 139 (x)->ki_dtor = NULL; \
141 (x)->ki_obj.tsk = tsk; \ 140 (x)->ki_obj.tsk = tsk; \
142 (x)->ki_user_data = 0; \ 141 (x)->ki_user_data = 0; \
143 init_wait((&(x)->ki_wait)); \
144 } while (0) 142 } while (0)
145 143
146#define AIO_RING_MAGIC 0xa10a10a1 144#define AIO_RING_MAGIC 0xa10a10a1
@@ -223,8 +221,6 @@ struct mm_struct;
223static inline void exit_aio(struct mm_struct *mm) { } 221static inline void exit_aio(struct mm_struct *mm) { }
224#endif /* CONFIG_AIO */ 222#endif /* CONFIG_AIO */
225 223
226#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
227
228static inline struct kiocb *list_kiocb(struct list_head *h) 224static inline struct kiocb *list_kiocb(struct list_head *h)
229{ 225{
230 return list_entry(h, struct kiocb, ki_list); 226 return list_entry(h, struct kiocb, ki_list);