On Wed, 2 May 2007, Trond Myklebust wrote:
> commit c5a4dd8b7c15927a8fbff83171b57cad675a79b9
> Author: Chuck Lever <[EMAIL PROTECTED]>
> Date:   Thu Mar 29 16:47:58 2007 -0400
> 
>     SUNRPC: Eliminate side effects from rpc_malloc
>     
>     Currently rpc_malloc sets req->rq_buffer internally.  Make this a more
>     generic interface:  return a pointer to the new buffer (or NULL) and
>     make the caller set req->rq_buffer and req->rq_bufsize.  This looks much
>     more like kmalloc and eliminates the side effects.
>     
>     To fix a potential deadlock, this patch also replaces GFP_NOFS with
>     GFP_NOWAIT in rpc_malloc.  This prevents async RPCs from sleeping outside
>     the RPC's task scheduler while allocating their buffer.
>     
>     Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
>     Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>

This patch introduced the following compiler warnings:

net/sunrpc/sched.c:766: warning: format ‘%u’ expects type ‘unsigned int’, but 
argument 3 has type ‘size_t’
net/sunrpc/sched.c:785: warning: format ‘%u’ expects type ‘unsigned int’, but 
argument 2 has type ‘size_t’

  - Use %zu to format size_t
  - Kill 2 useless casts

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>

--- ps3-linux-2.6.21.orig/net/sunrpc/sched.c
+++ ps3-linux-2.6.21/net/sunrpc/sched.c
@@ -763,9 +763,9 @@ void *rpc_malloc(struct rpc_task *task, 
        else
                buf = kmalloc(size, gfp);
        *buf = size;
-       dprintk("RPC: %5u allocated buffer of size %u at %p\n",
+       dprintk("RPC: %5u allocated buffer of size %zu at %p\n",
                        task->tk_pid, size, buf);
-       return (void *) ++buf;
+       return ++buf;
 }
 
 /**
@@ -775,14 +775,14 @@ void *rpc_malloc(struct rpc_task *task, 
  */
 void rpc_free(void *buffer)
 {
-       size_t size, *buf = (size_t *) buffer;
+       size_t size, *buf = buffer;
 
        if (!buffer)
                return;
        size = *buf;
        buf--;
 
-       dprintk("RPC:       freeing buffer of size %u at %p\n",
+       dprintk("RPC:       freeing buffer of size %zu at %p\n",
                        size, buf);
        if (size <= RPC_BUFFER_MAXSIZE)
                mempool_free(buf, rpc_buffer_mempool);

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
[EMAIL PROTECTED] ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium

Reply via email to