Christoph Hellwig
2020-May-21 08:34 UTC
[Ocfs2-devel] [PATCH 31/33] sctp: add sctp_sock_set_nodelay
On Wed, May 20, 2020 at 08:39:13PM -0300, Marcelo Ricardo Leitner wrote:> On Wed, May 20, 2020 at 04:23:55PM -0700, David Miller wrote: > > From: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com> > > Date: Wed, 20 May 2020 20:10:01 -0300 > > > > > The duplication with sctp_setsockopt_nodelay() is quite silly/bad. > > > Also, why have the 'true' hardcoded? It's what dlm uses, yes, but the > > > API could be a bit more complete than that. > > > > The APIs are being designed based upon what in-tree users actually > > make use of. We can expand things later if necessary. > > Sometimes expanding things later can be though, thus why the worry. > But ok, I get it. Thanks. > > The comment still applies, though. (re the duplication)Where do you see duplication? sctp_setsockopt_nodelay does the following things: - verifies optlen, returns -EINVAL if it doesn't match - calls get_user, returns -EFAULT on error - converts the value from get_user to a boolean and assigns it to sctp_sk(sk)->nodelay - returns 0. sctp_sock_set_nodelay does: - call lock_sock - assign true to sctp_sk(sk)->nodelay - call release_sock - does not return an error code
David Laight
2020-May-21 09:06 UTC
[Ocfs2-devel] [PATCH 31/33] sctp: add sctp_sock_set_nodelay
From: Christoph Hellwig> Sent: 21 May 2020 09:35 > On Wed, May 20, 2020 at 08:39:13PM -0300, Marcelo Ricardo Leitner wrote: > > On Wed, May 20, 2020 at 04:23:55PM -0700, David Miller wrote: > > > From: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com> > > > Date: Wed, 20 May 2020 20:10:01 -0300 > > > > > > > The duplication with sctp_setsockopt_nodelay() is quite silly/bad. > > > > Also, why have the 'true' hardcoded? It's what dlm uses, yes, but the > > > > API could be a bit more complete than that. > > > > > > The APIs are being designed based upon what in-tree users actually > > > make use of. We can expand things later if necessary. > > > > Sometimes expanding things later can be though, thus why the worry. > > But ok, I get it. Thanks. > > > > The comment still applies, though. (re the duplication) > > Where do you see duplication?The whole thing just doesn't scale. As soon as you get to the slightly more complex requests like SCTP_INITMSG (which should probably be called to set the required number of data streams) you've either got replicated code or nested wrappers. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Marcelo Ricardo Leitner
2020-May-21 13:33 UTC
[Ocfs2-devel] [PATCH 31/33] sctp: add sctp_sock_set_nodelay
On Thu, May 21, 2020 at 10:34:42AM +0200, Christoph Hellwig wrote:> On Wed, May 20, 2020 at 08:39:13PM -0300, Marcelo Ricardo Leitner wrote: > > On Wed, May 20, 2020 at 04:23:55PM -0700, David Miller wrote: > > > From: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com> > > > Date: Wed, 20 May 2020 20:10:01 -0300 > > > > > > > The duplication with sctp_setsockopt_nodelay() is quite silly/bad. > > > > Also, why have the 'true' hardcoded? It's what dlm uses, yes, but the > > > > API could be a bit more complete than that. > > > > > > The APIs are being designed based upon what in-tree users actually > > > make use of. We can expand things later if necessary. > > > > Sometimes expanding things later can be though, thus why the worry. > > But ok, I get it. Thanks. > > > > The comment still applies, though. (re the duplication) > > Where do you see duplication? > > sctp_setsockopt_nodelay does the following things: > > - verifies optlen, returns -EINVAL if it doesn't match > - calls get_user, returns -EFAULT on error > - converts the value from get_user to a boolean and assigns it > to sctp_sk(sk)->nodelay > - returns 0. > > sctp_sock_set_nodelay does: > > - call lock_sock > - assign true to sctp_sk(sk)->nodelay > - call release_sock > - does not return an error codeWith the patch there are now two ways of enabling nodelay. It may be just a boolean set today, but if one wants to probe on it or if we want to extend it with anything, say a debug msg, we have to do it in two (very different) places.