diff options
author | 2022-09-03 12:02:52 +0800 | |
---|---|---|
committer | 2022-09-06 14:12:03 +0300 | |
commit | db77d84cfe3608eac938302f8f7178e44415bcba (patch) | |
tree | 0d3409726b557e877e9e5b98d8e9f0f16786d7cc /drivers/infiniband/ulp | |
parent | RDMA/rtrs-clt: Break the loop once one path is connected (diff) | |
download | linux-db77d84cfe3608eac938302f8f7178e44415bcba.tar.gz linux-db77d84cfe3608eac938302f8f7178e44415bcba.tar.bz2 linux-db77d84cfe3608eac938302f8f7178e44415bcba.zip |
RDMA/rtrs-clt: Kill xchg_paths
Let's call try_cmpxchg directly for the same purpose.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Link: https://lore.kernel.org/r/20220903040252.29397-1-guoqing.jiang@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/rtrs/rtrs-clt.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index c29eccdb4fd2..d252676c7889 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2220,17 +2220,6 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path) } } -static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path, - struct rtrs_clt_path *clt_path, - struct rtrs_clt_path *next) -{ - struct rtrs_clt_path **ppcpu_path; - - /* Call cmpxchg() without sparse warnings */ - ppcpu_path = (typeof(ppcpu_path))rcu_ppcpu_path; - return clt_path == cmpxchg(ppcpu_path, clt_path, next); -} - static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path) { struct rtrs_clt_sess *clt = clt_path->clt; @@ -2305,7 +2294,8 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path) * We race with IO code path, which also changes pointer, * thus we have to be careful not to overwrite it. */ - if (xchg_paths(ppcpu_path, clt_path, next)) + if (try_cmpxchg((struct rtrs_clt_path **)ppcpu_path, &clt_path, + next)) /* * @ppcpu_path was successfully replaced with @next, * that means that someone could also pick up the |