Skip to content

Commit c0219c4

Browse files
committed
SUNRPC: Merge svc_do_enqueue_xprt() into svc_enqueue_xprt()
Neil says: "These functions were separated in commit 0971374 ("SUNRPC: Reduce contention in svc_xprt_enqueue()") so that the XPT_BUSY check happened before taking any spinlocks. We have since moved or removed the spinlocks so the extra test is fairly pointless." I've made this a separate patch in case the XPT_BUSY change has unexpected consequences and needs to be reverted. Suggested-by: Neil Brown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent a9ff2e9 commit c0219c4

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

net/sunrpc/svc_xprt.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ static int svc_deferred_recv(struct svc_rqst *rqstp);
3232
static struct cache_deferred_req *svc_defer(struct cache_req *req);
3333
static void svc_age_temp_xprts(struct timer_list *t);
3434
static void svc_delete_xprt(struct svc_xprt *xprt);
35-
static void svc_xprt_do_enqueue(struct svc_xprt *xprt);
3635

3736
/* apparently the "standard" is that clients close
3837
* idle connections after 5 minutes, servers after
@@ -267,12 +266,12 @@ void svc_xprt_received(struct svc_xprt *xprt)
267266
}
268267

269268
/* As soon as we clear busy, the xprt could be closed and
270-
* 'put', so we need a reference to call svc_xprt_do_enqueue with:
269+
* 'put', so we need a reference to call svc_xprt_enqueue with:
271270
*/
272271
svc_xprt_get(xprt);
273272
smp_mb__before_atomic();
274273
clear_bit(XPT_BUSY, &xprt->xpt_flags);
275-
svc_xprt_do_enqueue(xprt);
274+
svc_xprt_enqueue(xprt);
276275
svc_xprt_put(xprt);
277276
}
278277
EXPORT_SYMBOL_GPL(svc_xprt_received);
@@ -412,6 +411,8 @@ static bool svc_xprt_ready(struct svc_xprt *xprt)
412411
smp_rmb();
413412
xpt_flags = READ_ONCE(xprt->xpt_flags);
414413

414+
if (xpt_flags & BIT(XPT_BUSY))
415+
return false;
415416
if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE)))
416417
return true;
417418
if (xpt_flags & (BIT(XPT_DATA) | BIT(XPT_DEFERRED))) {
@@ -424,7 +425,12 @@ static bool svc_xprt_ready(struct svc_xprt *xprt)
424425
return false;
425426
}
426427

427-
static void svc_xprt_do_enqueue(struct svc_xprt *xprt)
428+
/**
429+
* svc_xprt_enqueue - Queue a transport on an idle nfsd thread
430+
* @xprt: transport with data pending
431+
*
432+
*/
433+
void svc_xprt_enqueue(struct svc_xprt *xprt)
428434
{
429435
struct svc_pool *pool;
430436
struct svc_rqst *rqstp = NULL;
@@ -468,18 +474,6 @@ static void svc_xprt_do_enqueue(struct svc_xprt *xprt)
468474
put_cpu();
469475
trace_svc_xprt_enqueue(xprt, rqstp);
470476
}
471-
472-
/*
473-
* Queue up a transport with data pending. If there are idle nfsd
474-
* processes, wake 'em up.
475-
*
476-
*/
477-
void svc_xprt_enqueue(struct svc_xprt *xprt)
478-
{
479-
if (test_bit(XPT_BUSY, &xprt->xpt_flags))
480-
return;
481-
svc_xprt_do_enqueue(xprt);
482-
}
483477
EXPORT_SYMBOL_GPL(svc_xprt_enqueue);
484478

485479
/*

0 commit comments

Comments
 (0)