View | Details | Raw Unified | Return to bug 204340 | Differences between
and this patch

Collapse All | Expand All

(-)rpc/svc.h (+6 lines)
Lines 729-734 extern SVCPOOL* svcpool_create(const cha Link Here
729
extern void svcpool_destroy(SVCPOOL *pool);
729
extern void svcpool_destroy(SVCPOOL *pool);
730
730
731
/*
731
/*
732
 * Close a service pool.  Similar to svcpool_destroy(), but it does not
733
 * free the data structures.  As such, the pool can be used again.
734
 */
735
extern void svcpool_close(SVCPOOL *pool);
736
737
/*
732
 * Transport independent svc_create routine.
738
 * Transport independent svc_create routine.
733
 */
739
 */
734
extern int svc_create(SVCPOOL *, void (*)(struct svc_req *, SVCXPRT *),
740
extern int svc_create(SVCPOOL *, void (*)(struct svc_req *, SVCXPRT *),
(-)rpc/svc.c (-2 / +40 lines)
Lines 75-80 static void svc_new_thread(SVCGROUP *grp Link Here
75
static void xprt_unregister_locked(SVCXPRT *xprt);
75
static void xprt_unregister_locked(SVCXPRT *xprt);
76
static void svc_change_space_used(SVCPOOL *pool, long delta);
76
static void svc_change_space_used(SVCPOOL *pool, long delta);
77
static bool_t svc_request_space_available(SVCPOOL *pool);
77
static bool_t svc_request_space_available(SVCPOOL *pool);
78
static void svcpool_cleanup(SVCPOOL *pool);
78
79
79
/* ***************  SVCXPRT related stuff **************** */
80
/* ***************  SVCXPRT related stuff **************** */
80
81
Lines 174-181 svcpool_create(const char *name, struct Link Here
174
	return pool;
175
	return pool;
175
}
176
}
176
177
177
void
178
/*
178
svcpool_destroy(SVCPOOL *pool)
179
 * Code common to svcpool_destroy() and svcpool_close(), which cleans up
180
 * the pool data structures.
181
 */
182
static void
183
svcpool_cleanup(SVCPOOL *pool)
179
{
184
{
180
	SVCGROUP *grp;
185
	SVCGROUP *grp;
181
	SVCXPRT *xprt, *nxprt;
186
	SVCXPRT *xprt, *nxprt;
Lines 211-216 svcpool_destroy(SVCPOOL *pool) Link Here
211
		mtx_lock(&pool->sp_lock);
216
		mtx_lock(&pool->sp_lock);
212
	}
217
	}
213
	mtx_unlock(&pool->sp_lock);
218
	mtx_unlock(&pool->sp_lock);
219
}
220
221
void
222
svcpool_destroy(SVCPOOL *pool)
223
{
224
	SVCGROUP *grp;
225
	int g;
226
227
	svcpool_cleanup(pool);
214
228
215
	for (g = 0; g < SVC_MAXGROUPS; g++) {
229
	for (g = 0; g < SVC_MAXGROUPS; g++) {
216
		grp = &pool->sp_groups[g];
230
		grp = &pool->sp_groups[g];
Lines 226-231 svcpool_destroy(SVCPOOL *pool) Link Here
226
}
240
}
227
241
228
/*
242
/*
243
 * Similar to svcpool_destroy(), except that it does not destroy the actual
244
 * data structures.  As such, "pool" may be used again.
245
 */
246
void
247
svcpool_close(SVCPOOL *pool)
248
{
249
	SVCGROUP *grp;
250
	int g;
251
252
	svcpool_cleanup(pool);
253
254
	/* Now, initialize the pool's state for a fresh svc_run() call. */
255
	mtx_lock(&pool->sp_lock);
256
	pool->sp_state = SVCPOOL_INIT;
257
	mtx_unlock(&pool->sp_lock);
258
	for (g = 0; g < SVC_MAXGROUPS; g++) {
259
		grp = &pool->sp_groups[g];
260
		mtx_lock(&grp->sg_lock);
261
		grp->sg_state = SVCPOOL_ACTIVE;
262
		mtx_unlock(&grp->sg_lock);
263
	}
264
}
265
266
/*
229
 * Sysctl handler to get the present thread count on a pool
267
 * Sysctl handler to get the present thread count on a pool
230
 */
268
 */
231
static int
269
static int
(-)fs/nfsserver/nfs_nfsdkrpc.c (-11 / +9 lines)
Lines 551-568 nfsrvd_init(int terminating) Link Here
551
		nfsd_master_proc = NULL;
551
		nfsd_master_proc = NULL;
552
		NFSD_UNLOCK();
552
		NFSD_UNLOCK();
553
		nfsrv_freeallbackchannel_xprts();
553
		nfsrv_freeallbackchannel_xprts();
554
		svcpool_destroy(nfsrvd_pool);
554
		svcpool_close(nfsrvd_pool);
555
		nfsrvd_pool = NULL;
555
		NFSD_LOCK();
556
	} else {
557
		NFSD_UNLOCK();
558
		nfsrvd_pool = svcpool_create("nfsd",
559
		    SYSCTL_STATIC_CHILDREN(_vfs_nfsd));
560
		nfsrvd_pool->sp_rcache = NULL;
561
		nfsrvd_pool->sp_assign = fhanew_assign;
562
		nfsrvd_pool->sp_done = fha_nd_complete;
556
		NFSD_LOCK();
563
		NFSD_LOCK();
557
	}
564
	}
558
559
	NFSD_UNLOCK();
560
561
	nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_nfsd));
562
	nfsrvd_pool->sp_rcache = NULL;
563
	nfsrvd_pool->sp_assign = fhanew_assign;
564
	nfsrvd_pool->sp_done = fha_nd_complete;
565
566
	NFSD_LOCK();
567
}
565
}
568
566

Return to bug 204340