[lustre-devel] [PATCH 07/24] lustre: lnet: cleanup of lnet_peer_ni_addref/decref_locked()
NeilBrown
neilb at suse.com
Sun Oct 7 16:19:37 PDT 2018
From: Olaf Weber <olaf at sgi.com>
Address style issues in lnet_peer_ni_addref_locked() and
lnet_peer_ni_decref_locked(). In the latter routine, replace
a sequence of atomic_dec()/atomic_read() with atomic_dec_and_test().
WC-bug-id: https://jira.whamcloud.com/browse/LU-9480
Signed-off-by: Olaf Weber <olaf at sgi.com>
Reviewed-on: https://review.whamcloud.com/25777
Reviewed-by: Olaf Weber <olaf.weber at hpe.com>
Reviewed-by: Amir Shehata <amir.shehata at intel.com>
Tested-by: Amir Shehata <amir.shehata at intel.com>
Signed-off-by: NeilBrown <neilb at suse.com>
---
.../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 2e2b5ed27116..f15f5c9c9a25 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -323,8 +323,7 @@ static inline void
lnet_peer_ni_decref_locked(struct lnet_peer_ni *lp)
{
LASSERT(atomic_read(&lp->lpni_refcount) > 0);
- atomic_dec(&lp->lpni_refcount);
- if (atomic_read(&lp->lpni_refcount) == 0)
+ if (atomic_dec_and_test(&lp->lpni_refcount))
lnet_destroy_peer_ni_locked(lp);
}
More information about the lustre-devel
mailing list