RDS: split out connection specific state from rds_connection to rds_conn_path
In preparation for multipath RDS, split the rds_connection structure into a base structure, and a per-path struct rds_conn_path. The base structure tracks information and locks common to all paths. The workqs for send/recv/shutdown etc are tracked per rds_conn_path. Thus the workq callbacks now work with rds_conn_path. This commit allows for one rds_conn_path per rds_connection, and will be extended into multiple conn_paths in subsequent commits. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
dcf1158b27
commit
0cb43965d4
@@ -36,6 +36,7 @@
|
||||
#include <linux/export.h>
|
||||
#include <net/inet_hashtables.h>
|
||||
|
||||
#include "rds_single_path.h"
|
||||
#include "rds.h"
|
||||
#include "loop.h"
|
||||
|
||||
@@ -155,6 +156,7 @@ static struct rds_connection *__rds_conn_create(struct net *net,
|
||||
conn->c_faddr = faddr;
|
||||
spin_lock_init(&conn->c_lock);
|
||||
conn->c_next_tx_seq = 1;
|
||||
conn->c_path[0].cp_conn = conn;
|
||||
rds_conn_net_set(conn, net);
|
||||
|
||||
init_waitqueue_head(&conn->c_waitq);
|
||||
@@ -197,7 +199,7 @@ static struct rds_connection *__rds_conn_create(struct net *net,
|
||||
|
||||
atomic_set(&conn->c_state, RDS_CONN_DOWN);
|
||||
conn->c_send_gen = 0;
|
||||
conn->c_outgoing = (is_outgoing ? 1 : 0);
|
||||
conn->c_path[0].cp_outgoing = (is_outgoing ? 1 : 0);
|
||||
conn->c_reconnect_jiffies = 0;
|
||||
INIT_DELAYED_WORK(&conn->c_send_w, rds_send_worker);
|
||||
INIT_DELAYED_WORK(&conn->c_recv_w, rds_recv_worker);
|
||||
@@ -320,8 +322,8 @@ void rds_conn_shutdown(struct rds_connection *conn)
|
||||
if (!hlist_unhashed(&conn->c_hash_node)) {
|
||||
rcu_read_unlock();
|
||||
if (conn->c_trans->t_type != RDS_TRANS_TCP ||
|
||||
conn->c_outgoing == 1)
|
||||
rds_queue_reconnect(conn);
|
||||
conn->c_path[0].cp_outgoing == 1)
|
||||
rds_queue_reconnect(&conn->c_path[0]);
|
||||
} else {
|
||||
rcu_read_unlock();
|
||||
}
|
||||
@@ -553,10 +555,16 @@ void rds_conn_exit(void)
|
||||
/*
|
||||
* Force a disconnect
|
||||
*/
|
||||
void rds_conn_path_drop(struct rds_conn_path *cp)
|
||||
{
|
||||
atomic_set(&cp->cp_state, RDS_CONN_ERROR);
|
||||
queue_work(rds_wq, &cp->cp_down_w);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rds_conn_path_drop);
|
||||
|
||||
void rds_conn_drop(struct rds_connection *conn)
|
||||
{
|
||||
atomic_set(&conn->c_state, RDS_CONN_ERROR);
|
||||
queue_work(rds_wq, &conn->c_down_w);
|
||||
rds_conn_path_drop(&conn->c_path[0]);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rds_conn_drop);
|
||||
|
||||
|
Reference in New Issue
Block a user