Re: [PATCH 2/5] io_uring: refactor io_assign_file error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/18/22 2:50 PM, Jens Axboe wrote:
> On 4/18/22 1:51 PM, Pavel Begunkov wrote:
>> All io_assign_file() callers do error handling themselves,
>> req_set_fail() in the io_assign_file()'s fail path needlessly bloats the
>> kernel and is not the best abstraction to have. Simplify the error path.
>>
>> Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
>> ---
>>  fs/io_uring.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 423427e2203f..9626bc1cb0a0 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -7117,12 +7117,8 @@ static bool io_assign_file(struct io_kiocb *req, unsigned int issue_flags)
>>  		req->file = io_file_get_fixed(req, req->cqe.fd, issue_flags);
>>  	else
>>  		req->file = io_file_get_normal(req, req->cqe.fd);
>> -	if (req->file)
>> -		return true;
>>  
>> -	req_set_fail(req);
>> -	req->cqe.res = -EBADF;
>> -	return false;
>> +	return !!req->file;
> 
> Wouldn't it be cleaner to just do:

As soon as I sent that, realize we're missing the file assignment
in that case. Stupid. Looks fine as-is.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux