mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 00:28:52 +02:00 
			
		
		
		
	io_uring/rw: allocate async data in io_prep_rw()
rw always allocates async_data, so instead of doing that deeper in prep calls inside of io_prep_rw_setup(), be a bit more explicit and do that early on in io_prep_rw(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/5ead621051bc3374d1e8d96f816454906a6afd71.1740425922.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									c457eed55d
								
							
						
					
					
						commit
						c72282dd86
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -203,9 +203,6 @@ static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) | |||
| { | ||||
| 	struct io_async_rw *rw; | ||||
| 
 | ||||
| 	if (io_rw_alloc_async(req)) | ||||
| 		return -ENOMEM; | ||||
| 
 | ||||
| 	if (!do_import || io_do_buffer_select(req)) | ||||
| 		return 0; | ||||
| 
 | ||||
|  | @ -262,6 +259,9 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, | |||
| 	u64 attr_type_mask; | ||||
| 	int ret; | ||||
| 
 | ||||
| 	if (io_rw_alloc_async(req)) | ||||
| 		return -ENOMEM; | ||||
| 
 | ||||
| 	rw->kiocb.ki_pos = READ_ONCE(sqe->off); | ||||
| 	/* used for fixed read/write too - just read unconditionally */ | ||||
| 	req->buf_index = READ_ONCE(sqe->buf_index); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pavel Begunkov
						Pavel Begunkov