On Friday 12 July 2013 04:49:54 WangChen wrote:
> Hi, Oliver,
> Regarding skel_write, I see your current desgin only refuse its execution
> when> WRITES_IN_FLIGHT are on the fly, but this is not blocking IO due to
> write() will not wait before callback returns, right? Do you think it's
> unnecessary to support blocking IO on write or any special reason else?
/*
* limit the number of URBs in flight to stop a user from using up all
* RAM
*/
if (!(file->f_flags & O_NONBLOCK)) {
if (down_interruptible(&dev->limit_sem)) {
The limit_sem will cause write() to wait for IO to finish,
if the limit is reached
retval = -ERESTARTSYS;
goto exit;
}
} else {
if (down_trylock(&dev->limit_sem)) {
retval = -EAGAIN;
Unless non-blocking IO is used. In that case we return.
goto exit;
}
}
Blocking IO is perfectly well supported. To keep under the limit you don't
have to wait for the IO you started. Any IO will serve the purpose.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html