@@ -3074,27 +3074,6 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
3074
3074
return 1 ;
3075
3075
}
3076
3076
3077
- static inline int kiocb_wait_page_queue_init (struct kiocb * kiocb ,
3078
- struct wait_page_queue * wait ,
3079
- wait_queue_func_t func ,
3080
- void * data )
3081
- {
3082
- /* Can't support async wakeup with polled IO */
3083
- if (kiocb -> ki_flags & IOCB_HIPRI )
3084
- return - EINVAL ;
3085
- if (kiocb -> ki_filp -> f_mode & FMODE_BUF_RASYNC ) {
3086
- wait -> wait .func = func ;
3087
- wait -> wait .private = data ;
3088
- wait -> wait .flags = 0 ;
3089
- INIT_LIST_HEAD (& wait -> wait .entry );
3090
- kiocb -> ki_flags |= IOCB_WAITQ ;
3091
- kiocb -> ki_waitq = wait ;
3092
- return 0 ;
3093
- }
3094
-
3095
- return - EOPNOTSUPP ;
3096
- }
3097
-
3098
3077
/*
3099
3078
* This controls whether a given IO request should be armed for async page
3100
3079
* based retry. If we return false here, the request is handed to the async
@@ -3109,31 +3088,33 @@ static inline int kiocb_wait_page_queue_init(struct kiocb *kiocb,
3109
3088
*/
3110
3089
static bool io_rw_should_retry (struct io_kiocb * req )
3111
3090
{
3091
+ struct wait_page_queue * wait = & req -> io -> rw .wpq ;
3112
3092
struct kiocb * kiocb = & req -> rw .kiocb ;
3113
- int ret ;
3114
3093
3115
3094
/* never retry for NOWAIT, we just complete with -EAGAIN */
3116
3095
if (req -> flags & REQ_F_NOWAIT )
3117
3096
return false;
3118
3097
3119
3098
/* Only for buffered IO */
3120
- if (kiocb -> ki_flags & IOCB_DIRECT )
3099
+ if (kiocb -> ki_flags & ( IOCB_DIRECT | IOCB_HIPRI ) )
3121
3100
return false;
3101
+
3122
3102
/*
3123
3103
* just use poll if we can, and don't attempt if the fs doesn't
3124
3104
* support callback based unlocks
3125
3105
*/
3126
3106
if (file_can_poll (req -> file ) || !(req -> file -> f_mode & FMODE_BUF_RASYNC ))
3127
3107
return false;
3128
3108
3129
- ret = kiocb_wait_page_queue_init ( kiocb , & req -> io -> rw . wpq ,
3130
- io_async_buf_func , req ) ;
3131
- if (! ret ) {
3132
- io_get_req_task ( req );
3133
- return true ;
3134
- }
3109
+ wait -> wait . func = io_async_buf_func ;
3110
+ wait -> wait . private = req ;
3111
+ wait -> wait . flags = 0 ;
3112
+ INIT_LIST_HEAD ( & wait -> wait . entry );
3113
+ kiocb -> ki_flags |= IOCB_WAITQ ;
3114
+ kiocb -> ki_waitq = wait ;
3135
3115
3136
- return false;
3116
+ io_get_req_task (req );
3117
+ return true;
3137
3118
}
3138
3119
3139
3120
static int io_iter_do_read (struct io_kiocb * req , struct iov_iter * iter )
0 commit comments