Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket O_NONBLOCK

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Evgeniy Polyakov <johnpol@...>
Cc: <netdev@...>, <linux-kernel@...>, <axboe@...>
Date: Saturday, July 19, 2008 - 7:18 am

On Saturday 19 July 2008, Evgeniy Polyakov wrote:


My patch makes SPLICE_F_NONBLOCK work only on the pipe, it stops 
SPLICE_F_NONBLOCK giving non-blocking semantics to the socket. It thus allows 
the application to control the "blockiness" of pipe and socket operations 
_independently_:
- you want blocking operations on the socket: you use O_NONBLOCK.
- you want blocking operations on the pipe: you use SPLICE_F_NONBLOCK

It has a limitation though: you are not able to control the "blockiness" of 
the socket operation during the splice call. Thats why I propose using two 
flags: one for the pipe and one for the socket.


Correct. 


What I would like is to have the ability to do blocking operations on the 
socket and non-blocking operations on the pipe.



Correct. 


Correct.



But in the larger picture it means that: 

(a) a simple single threaded program that copies data from a socket to a file 
with splice, using  blocking operations on the socket and file, will not work 
as it can block in the 1st splice if we specify a non tiny buffer. So, we 
will either:

(b) need to use threads to read from the pipe and unblock it, or 

(c) need to use full non-blocking operations with the whole poll/epoll/select 
bits implemented

If you agree with the above statement, and you think that it is ok to be 
forced to use (b) or (c) instead of (a), than I'll be happy to stop the 
discussion here since its getting into a matter of personal interpretation of 
what a good API is :)


Indeed :) 

My bad, I probably should have explained this in more details from the 
beginning. Thanks for taking the time to debate this, despite of my poor 
explanations.

Thanks,
tavi
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Thu Jul 17, 10:21 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Thu Jul 17, 10:47 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Fri Jul 18, 10:04 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Fri Jul 18, 10:32 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Fri Jul 18, 11:50 am)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Evgeniy Polyakov, (Fri Jul 18, 12:00 pm)
Re: [PATCH] tcp: do not promote SPLICE_F_NONBLOCK to socket ..., Octavian Purdila, (Sat Jul 19, 7:18 am)