@@ -600,7 +600,6 @@ enum {
600
600
struct async_poll {
601
601
struct io_poll_iocb poll ;
602
602
struct io_poll_iocb * double_poll ;
603
- struct io_wq_work work ;
604
603
};
605
604
606
605
/*
@@ -641,36 +640,26 @@ struct io_kiocb {
641
640
u16 buf_index ;
642
641
u32 result ;
643
642
644
- struct io_ring_ctx * ctx ;
645
- unsigned int flags ;
646
- refcount_t refs ;
647
- struct task_struct * task ;
648
- u64 user_data ;
643
+ struct io_ring_ctx * ctx ;
644
+ unsigned int flags ;
645
+ refcount_t refs ;
646
+ struct task_struct * task ;
647
+ u64 user_data ;
649
648
650
- struct list_head link_list ;
649
+ struct list_head link_list ;
651
650
652
651
/*
653
652
* 1. used with ctx->iopoll_list with reads/writes
654
653
* 2. to track reqs with ->files (see io_op_def::file_table)
655
654
*/
656
- struct list_head inflight_entry ;
657
-
658
- struct percpu_ref * fixed_file_refs ;
659
-
660
- union {
661
- /*
662
- * Only commands that never go async can use the below fields,
663
- * obviously. Right now only IORING_OP_POLL_ADD uses them, and
664
- * async armed poll handlers for regular commands. The latter
665
- * restore the work, if needed.
666
- */
667
- struct {
668
- struct hlist_node hash_node ;
669
- struct async_poll * apoll ;
670
- };
671
- struct io_wq_work work ;
672
- };
673
- struct callback_head task_work ;
655
+ struct list_head inflight_entry ;
656
+
657
+ struct percpu_ref * fixed_file_refs ;
658
+ struct callback_head task_work ;
659
+ /* for polled requests, i.e. IORING_OP_POLL_ADD and async armed poll */
660
+ struct hlist_node hash_node ;
661
+ struct async_poll * apoll ;
662
+ struct io_wq_work work ;
674
663
};
675
664
676
665
struct io_defer_entry {
@@ -4668,10 +4657,6 @@ static void io_async_task_func(struct callback_head *cb)
4668
4657
io_poll_remove_double (req , apoll -> double_poll );
4669
4658
spin_unlock_irq (& ctx -> completion_lock );
4670
4659
4671
- /* restore ->work in case we need to retry again */
4672
- if (req -> flags & REQ_F_WORK_INITIALIZED )
4673
- memcpy (& req -> work , & apoll -> work , sizeof (req -> work ));
4674
-
4675
4660
if (!READ_ONCE (apoll -> poll .canceled ))
4676
4661
__io_req_task_submit (req );
4677
4662
else
@@ -4763,9 +4748,6 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
4763
4748
apoll -> double_poll = NULL ;
4764
4749
4765
4750
req -> flags |= REQ_F_POLLED ;
4766
- if (req -> flags & REQ_F_WORK_INITIALIZED )
4767
- memcpy (& apoll -> work , & req -> work , sizeof (req -> work ));
4768
-
4769
4751
io_get_req_task (req );
4770
4752
req -> apoll = apoll ;
4771
4753
INIT_HLIST_NODE (& req -> hash_node );
@@ -4784,8 +4766,6 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
4784
4766
if (ret ) {
4785
4767
io_poll_remove_double (req , apoll -> double_poll );
4786
4768
spin_unlock_irq (& ctx -> completion_lock );
4787
- if (req -> flags & REQ_F_WORK_INITIALIZED )
4788
- memcpy (& req -> work , & apoll -> work , sizeof (req -> work ));
4789
4769
kfree (apoll -> double_poll );
4790
4770
kfree (apoll );
4791
4771
return false;
@@ -4828,14 +4808,6 @@ static bool io_poll_remove_one(struct io_kiocb *req)
4828
4808
do_complete = __io_poll_remove_one (req , & apoll -> poll );
4829
4809
if (do_complete ) {
4830
4810
io_put_req (req );
4831
- /*
4832
- * restore ->work because we will call
4833
- * io_req_clean_work below when dropping the
4834
- * final reference.
4835
- */
4836
- if (req -> flags & REQ_F_WORK_INITIALIZED )
4837
- memcpy (& req -> work , & apoll -> work ,
4838
- sizeof (req -> work ));
4839
4811
kfree (apoll -> double_poll );
4840
4812
kfree (apoll );
4841
4813
}
@@ -4969,9 +4941,6 @@ static int io_poll_add(struct io_kiocb *req)
4969
4941
struct io_poll_table ipt ;
4970
4942
__poll_t mask ;
4971
4943
4972
- /* ->work is in union with hash_node and others */
4973
- io_req_clean_work (req );
4974
-
4975
4944
INIT_HLIST_NODE (& req -> hash_node );
4976
4945
ipt .pt ._qproc = io_poll_queue_proc ;
4977
4946
0 commit comments