On 3/25/24 6:03 AM, Anuj gupta wrote: >> +static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) >> +{ >> + struct io_async_rw *rw; >> + int ret; >> + >> + if (io_rw_alloc_async(req)) >> + return -ENOMEM; >> + >> + if (!do_import || io_do_buffer_select(req)) >> + return 0; >> + >> + rw = req->async_data; >> + ret = io_import_iovec(ddir, req, rw, 0); >> + if (unlikely(ret < 0)) >> + return ret; >> + >> + iov_iter_save_state(&rw->s.iter, &rw->s.iter_state); > > It seems that the state of iov_iter gets saved in the caller io_import_iovec > as well. Do we need to save it again here? There's probably room left for further cleaning this up, as now the state is always going to be known. But it isn't true right now - for example, __io_read() will import and not save, yet do a restore if we need to ensure the state is sane again. -- Jens Axboe