All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning
@ 2018-06-13 12:01 Geert Uytterhoeven
  2018-06-14 17:19   ` Chuck Lever
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-06-13 12:01 UTC (permalink / raw)
  To: Chuck Lever, J . Bruce Fields, Jeff Layton, Trond Myklebust,
	Anna Schumaker, David S . Miller
  Cc: linux-nfs, netdev, linux-kernel, Geert Uytterhoeven

With gcc 4.1.2:

    net/sunrpc/xprt.c:69: warning: ‘xprt_alloc_xid’ declared inline after being called
    net/sunrpc/xprt.c:69: warning: previous declaration of ‘xprt_alloc_xid’ was here

To fix this, move the function up, before its caller, and remove the no
longer needed forward declaration.

Fixes: 37ac86c3a76c1136 ("SUNRPC: Initialize rpc_rqst outside of xprt->reserve_lock")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 net/sunrpc/xprt.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 3c85af058227d14b..60a8b9f91cf94b54 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -66,7 +66,6 @@
  * Local functions
  */
 static void	 xprt_init(struct rpc_xprt *xprt, struct net *net);
-static __be32	xprt_alloc_xid(struct rpc_xprt *xprt);
 static void	xprt_connect_status(struct rpc_task *task);
 static int      __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
 static void     __xprt_put_cong(struct rpc_xprt *, struct rpc_rqst *);
@@ -956,6 +955,11 @@ static void xprt_timer(struct rpc_task *task)
 		task->tk_status = 0;
 }
 
+static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
+{
+	return (__force __be32)xprt->xid++;
+}
+
 /**
  * xprt_prepare_transmit - reserve the transport before sending a request
  * @task: RPC task about to send a request
@@ -1296,11 +1300,6 @@ void xprt_retry_reserve(struct rpc_task *task)
 	xprt->ops->alloc_slot(xprt, task);
 }
 
-static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
-{
-	return (__force __be32)xprt->xid++;
-}
-
 static inline void xprt_init_xid(struct rpc_xprt *xprt)
 {
 	xprt->xid = prandom_u32();
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning
  2018-06-13 12:01 [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning Geert Uytterhoeven
@ 2018-06-14 17:19   ` Chuck Lever
  0 siblings, 0 replies; 4+ messages in thread
From: Chuck Lever @ 2018-06-14 17:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bruce Fields, Jeff Layton, Trond Myklebust, Anna Schumaker,
	David S . Miller, Linux NFS Mailing List, netdev, linux-kernel



> On Jun 13, 2018, at 8:01 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> With gcc 4.1.2:
> 
>    net/sunrpc/xprt.c:69: warning: ‘xprt_alloc_xid’ declared inline after being called
>    net/sunrpc/xprt.c:69: warning: previous declaration of ‘xprt_alloc_xid’ was here
> 
> To fix this, move the function up, before its caller, and remove the no
> longer needed forward declaration.
> 
> Fixes: 37ac86c3a76c1136 ("SUNRPC: Initialize rpc_rqst outside of xprt->reserve_lock")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> net/sunrpc/xprt.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 3c85af058227d14b..60a8b9f91cf94b54 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -66,7 +66,6 @@
>  * Local functions
>  */
> static void	 xprt_init(struct rpc_xprt *xprt, struct net *net);
> -static __be32	xprt_alloc_xid(struct rpc_xprt *xprt);
> static void	xprt_connect_status(struct rpc_task *task);
> static int      __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
> static void     __xprt_put_cong(struct rpc_xprt *, struct rpc_rqst *);
> @@ -956,6 +955,11 @@ static void xprt_timer(struct rpc_task *task)
> 		task->tk_status = 0;
> }
> 
> +static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> +{
> +	return (__force __be32)xprt->xid++;
> +}
> +
> /**
>  * xprt_prepare_transmit - reserve the transport before sending a request
>  * @task: RPC task about to send a request
> @@ -1296,11 +1300,6 @@ void xprt_retry_reserve(struct rpc_task *task)
> 	xprt->ops->alloc_slot(xprt, task);
> }
> 
> -static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> -{
> -	return (__force __be32)xprt->xid++;
> -}
> -

For code organization, we might want to keep xprt_alloc_xid
together with xprt_init_xid. Would it be better to simply
remove the "inline" directive from these two and let the
compiler choose the best optimization?


> static inline void xprt_init_xid(struct rpc_xprt *xprt)
> {
> 	xprt->xid = prandom_u32();
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning
@ 2018-06-14 17:19   ` Chuck Lever
  0 siblings, 0 replies; 4+ messages in thread
From: Chuck Lever @ 2018-06-14 17:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bruce Fields, Jeff Layton, Trond Myklebust, Anna Schumaker,
	David S . Miller, Linux NFS Mailing List, netdev, linux-kernel



> On Jun 13, 2018, at 8:01 AM, Geert Uytterhoeven <geert@linux-m68k.org> =
wrote:
>=20
> With gcc 4.1.2:
>=20
>    net/sunrpc/xprt.c:69: warning: =E2=80=98xprt_alloc_xid=E2=80=99 =
declared inline after being called
>    net/sunrpc/xprt.c:69: warning: previous declaration of =
=E2=80=98xprt_alloc_xid=E2=80=99 was here
>=20
> To fix this, move the function up, before its caller, and remove the =
no
> longer needed forward declaration.
>=20
> Fixes: 37ac86c3a76c1136 ("SUNRPC: Initialize rpc_rqst outside of =
xprt->reserve_lock")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> net/sunrpc/xprt.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>=20
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index 3c85af058227d14b..60a8b9f91cf94b54 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -66,7 +66,6 @@
>  * Local functions
>  */
> static void	 xprt_init(struct rpc_xprt *xprt, struct net *net);
> -static __be32	xprt_alloc_xid(struct rpc_xprt *xprt);
> static void	xprt_connect_status(struct rpc_task *task);
> static int      __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
> static void     __xprt_put_cong(struct rpc_xprt *, struct rpc_rqst *);
> @@ -956,6 +955,11 @@ static void xprt_timer(struct rpc_task *task)
> 		task->tk_status =3D 0;
> }
>=20
> +static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> +{
> +	return (__force __be32)xprt->xid++;
> +}
> +
> /**
>  * xprt_prepare_transmit - reserve the transport before sending a =
request
>  * @task: RPC task about to send a request
> @@ -1296,11 +1300,6 @@ void xprt_retry_reserve(struct rpc_task *task)
> 	xprt->ops->alloc_slot(xprt, task);
> }
>=20
> -static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> -{
> -	return (__force __be32)xprt->xid++;
> -}
> -

For code organization, we might want to keep xprt_alloc_xid
together with xprt_init_xid. Would it be better to simply
remove the "inline" directive from these two and let the
compiler choose the best optimization?


> static inline void xprt_init_xid(struct rpc_xprt *xprt)
> {
> 	xprt->xid =3D prandom_u32();
> --=20
> 2.7.4
>=20
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning
  2018-06-14 17:19   ` Chuck Lever
  (?)
@ 2018-06-15  8:23   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-06-15  8:23 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Bruce Fields, jlayton, trond.myklebust, Anna Schumaker,
	David S. Miller, open list:NFS, SUNRPC, AND...,
	netdev, Linux Kernel Mailing List

Hi Chuck,

On Thu, Jun 14, 2018 at 7:20 PM Chuck Lever <chuck.lever@oracle.com> wrote:
> > On Jun 13, 2018, at 8:01 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >
> > With gcc 4.1.2:
> >
> >    net/sunrpc/xprt.c:69: warning: ‘xprt_alloc_xid’ declared inline after being called
> >    net/sunrpc/xprt.c:69: warning: previous declaration of ‘xprt_alloc_xid’ was here
> >
> > To fix this, move the function up, before its caller, and remove the no
> > longer needed forward declaration.
> >
> > Fixes: 37ac86c3a76c1136 ("SUNRPC: Initialize rpc_rqst outside of xprt->reserve_lock")
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > ---
> > net/sunrpc/xprt.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> > index 3c85af058227d14b..60a8b9f91cf94b54 100644
> > --- a/net/sunrpc/xprt.c
> > +++ b/net/sunrpc/xprt.c
> > @@ -66,7 +66,6 @@
> >  * Local functions
> >  */
> > static void    xprt_init(struct rpc_xprt *xprt, struct net *net);
> > -static __be32        xprt_alloc_xid(struct rpc_xprt *xprt);
> > static void   xprt_connect_status(struct rpc_task *task);
> > static int      __xprt_get_cong(struct rpc_xprt *, struct rpc_task *);
> > static void     __xprt_put_cong(struct rpc_xprt *, struct rpc_rqst *);
> > @@ -956,6 +955,11 @@ static void xprt_timer(struct rpc_task *task)
> >               task->tk_status = 0;
> > }
> >
> > +static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> > +{
> > +     return (__force __be32)xprt->xid++;
> > +}
> > +
> > /**
> >  * xprt_prepare_transmit - reserve the transport before sending a request
> >  * @task: RPC task about to send a request
> > @@ -1296,11 +1300,6 @@ void xprt_retry_reserve(struct rpc_task *task)
> >       xprt->ops->alloc_slot(xprt, task);
> > }
> >
> > -static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
> > -{
> > -     return (__force __be32)xprt->xid++;
> > -}
> > -
>
> For code organization, we might want to keep xprt_alloc_xid
> together with xprt_init_xid. Would it be better to simply
> remove the "inline" directive from these two and let the
> compiler choose the best optimization?

That's an option, too.

> > static inline void xprt_init_xid(struct rpc_xprt *xprt)
> > {
> >       xprt->xid = prandom_u32();

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-15  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-13 12:01 [PATCH] SUNRPC: Move inline xprt_alloc_xid() up to fix compiler warning Geert Uytterhoeven
2018-06-14 17:19 ` Chuck Lever
2018-06-14 17:19   ` Chuck Lever
2018-06-15  8:23   ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.