]> err.no Git - linux-2.6/blobdiff - net/sunrpc/svc.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireles...
[linux-2.6] / net / sunrpc / svc.c
index b76963d52657f145c2b8f9f3c5be23cdf08d1427..d74c2d269539a03a4267dcc93d195ca20e68d522 100644 (file)
@@ -301,7 +301,6 @@ static inline int
 svc_pool_map_set_cpumask(unsigned int pidx, cpumask_t *oldmask)
 {
        struct svc_pool_map *m = &svc_pool_map;
-       unsigned int node; /* or cpu */
 
        /*
         * The caller checks for sv_nrpools > 1, which
@@ -314,16 +313,23 @@ svc_pool_map_set_cpumask(unsigned int pidx, cpumask_t *oldmask)
        default:
                return 0;
        case SVC_POOL_PERCPU:
-               node = m->pool_to[pidx];
+       {
+               unsigned int cpu = m->pool_to[pidx];
+
                *oldmask = current->cpus_allowed;
-               set_cpus_allowed(current, cpumask_of_cpu(node));
+               set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
                return 1;
+       }
        case SVC_POOL_PERNODE:
-               node = m->pool_to[pidx];
+       {
+               unsigned int node = m->pool_to[pidx];
+               node_to_cpumask_ptr(nodecpumask, node);
+
                *oldmask = current->cpus_allowed;
-               set_cpus_allowed(current, node_to_cpumask(node));
+               set_cpus_allowed_ptr(current, nodecpumask);
                return 1;
        }
+       }
 }
 
 /*
@@ -364,7 +370,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
           void (*shutdown)(struct svc_serv *serv))
 {
        struct svc_serv *serv;
-       int vers;
+       unsigned int vers;
        unsigned int xdrsize;
        unsigned int i;
 
@@ -433,6 +439,7 @@ svc_create(struct svc_program *prog, unsigned int bufsize,
 {
        return __svc_create(prog, bufsize, /*npools*/1, shutdown);
 }
+EXPORT_SYMBOL(svc_create);
 
 struct svc_serv *
 svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
@@ -452,6 +459,7 @@ svc_create_pooled(struct svc_program *prog, unsigned int bufsize,
 
        return serv;
 }
+EXPORT_SYMBOL(svc_create_pooled);
 
 /*
  * Destroy an RPC service.  Should be called with the BKL held
@@ -493,6 +501,7 @@ svc_destroy(struct svc_serv *serv)
        kfree(serv->sv_pools);
        kfree(serv);
 }
+EXPORT_SYMBOL(svc_destroy);
 
 /*
  * Allocate an RPC server's buffer space.
@@ -501,8 +510,7 @@ svc_destroy(struct svc_serv *serv)
 static int
 svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
 {
-       int pages;
-       int arghi;
+       unsigned int pages, arghi;
 
        pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply.
                                       * We assume one is at most one page
@@ -516,7 +524,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
                rqstp->rq_pages[arghi++] = p;
                pages--;
        }
-       return ! pages;
+       return pages == 0;
 }
 
 /*
@@ -525,8 +533,9 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
 static void
 svc_release_buffer(struct svc_rqst *rqstp)
 {
-       int i;
-       for (i=0; i<ARRAY_SIZE(rqstp->rq_pages); i++)
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++)
                if (rqstp->rq_pages[i])
                        put_page(rqstp->rq_pages[i]);
 }
@@ -581,7 +590,7 @@ __svc_create_thread(svc_thread_fn func, struct svc_serv *serv,
        struct svc_rqst *rqstp;
        int             error = -ENOMEM;
        int             have_oldmask = 0;
-       cpumask_t       oldmask;
+       cpumask_t       uninitialized_var(oldmask);
 
        rqstp = svc_prepare_thread(serv, pool);
        if (IS_ERR(rqstp)) {
@@ -609,15 +618,6 @@ out_thread:
        goto out;
 }
 
-/*
- * Create a thread in the default pool.  Caller must hold BKL.
- */
-int
-svc_create_thread(svc_thread_fn func, struct svc_serv *serv)
-{
-       return __svc_create_thread(func, serv, &serv->sv_pools[0]);
-}
-
 /*
  * Choose a pool in which to create a new thread, for svc_set_num_threads
  */
@@ -720,6 +720,7 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
 
        return error;
 }
+EXPORT_SYMBOL(svc_set_num_threads);
 
 /*
  * Called from a server thread as it's exiting.  Caller must hold BKL.
@@ -746,6 +747,7 @@ svc_exit_thread(struct svc_rqst *rqstp)
        if (serv)
                svc_destroy(serv);
 }
+EXPORT_SYMBOL(svc_exit_thread);
 
 /*
  * Register an RPC service with the local portmapper.
@@ -757,7 +759,8 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port)
 {
        struct svc_program      *progp;
        unsigned long           flags;
-       int                     i, error = 0, dummy;
+       unsigned int            i;
+       int                     error = 0, dummy;
 
        if (!port)
                clear_thread_flag(TIF_SIGPENDING);
@@ -908,8 +911,7 @@ svc_process(struct svc_rqst *rqstp)
        case SVC_OK:
                break;
        case SVC_GARBAGE:
-               rpc_stat = rpc_garbage_args;
-               goto err_bad;
+               goto err_garbage;
        case SVC_SYSERR:
                rpc_stat = rpc_system_err;
                goto err_bad;
@@ -1069,6 +1071,7 @@ err_bad:
        svc_putnl(resv, ntohl(rpc_stat));
        goto sendit;
 }
+EXPORT_SYMBOL(svc_process);
 
 /*
  * Return (transport-specific) limit on the rpc payload.