diff options
author | Andy Grover <andy.grover@oracle.com> | 2010-01-19 21:14:56 -0500 |
---|---|---|
committer | Andy Grover <andy.grover@oracle.com> | 2010-09-08 21:11:54 -0400 |
commit | d37c9359056f4f07b37e59810f0ece1031e280b2 (patch) | |
tree | a8521aadd8d6373c0f6944d6447b000ea73aab71 /net/rds | |
parent | c8de3f1005e8359ea07083e37f3f993646e1adba (diff) |
RDS: Move loop-only function to loop.c
Also, try to better-document the locking around the
rm and its m_inc in loop.c.
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/loop.c | 15 | ||||
-rw-r--r-- | net/rds/message.c | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/net/rds/loop.c b/net/rds/loop.c index 9364de6dcd8b..4a3dd49315b4 100644 --- a/net/rds/loop.c +++ b/net/rds/loop.c | |||
@@ -64,7 +64,8 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
64 | BUG_ON(hdr_off || sg || off); | 64 | BUG_ON(hdr_off || sg || off); |
65 | 65 | ||
66 | rds_inc_init(&rm->m_inc, conn, conn->c_laddr); | 66 | rds_inc_init(&rm->m_inc, conn, conn->c_laddr); |
67 | rds_message_addref(rm); /* for the inc */ | 67 | /* For the embedded inc. Matching put is in loop_inc_free() */ |
68 | rds_message_addref(rm); | ||
68 | 69 | ||
69 | rds_recv_incoming(conn, conn->c_laddr, conn->c_faddr, &rm->m_inc, | 70 | rds_recv_incoming(conn, conn->c_laddr, conn->c_faddr, &rm->m_inc, |
70 | GFP_KERNEL, KM_USER0); | 71 | GFP_KERNEL, KM_USER0); |
@@ -77,6 +78,16 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
77 | return sizeof(struct rds_header) + be32_to_cpu(rm->m_inc.i_hdr.h_len); | 78 | return sizeof(struct rds_header) + be32_to_cpu(rm->m_inc.i_hdr.h_len); |
78 | } | 79 | } |
79 | 80 | ||
81 | /* | ||
82 | * See rds_loop_xmit(). Since our inc is embedded in the rm, we | ||
83 | * make sure the rm lives at least until the inc is done. | ||
84 | */ | ||
85 | static void rds_loop_inc_free(struct rds_incoming *inc) | ||
86 | { | ||
87 | struct rds_message *rm = container_of(inc, struct rds_message, m_inc); | ||
88 | rds_message_put(rm); | ||
89 | } | ||
90 | |||
80 | static int rds_loop_xmit_cong_map(struct rds_connection *conn, | 91 | static int rds_loop_xmit_cong_map(struct rds_connection *conn, |
81 | struct rds_cong_map *map, | 92 | struct rds_cong_map *map, |
82 | unsigned long offset) | 93 | unsigned long offset) |
@@ -176,6 +187,6 @@ struct rds_transport rds_loop_transport = { | |||
176 | .conn_connect = rds_loop_conn_connect, | 187 | .conn_connect = rds_loop_conn_connect, |
177 | .conn_shutdown = rds_loop_conn_shutdown, | 188 | .conn_shutdown = rds_loop_conn_shutdown, |
178 | .inc_copy_to_user = rds_message_inc_copy_to_user, | 189 | .inc_copy_to_user = rds_message_inc_copy_to_user, |
179 | .inc_free = rds_message_inc_free, | 190 | .inc_free = rds_loop_inc_free, |
180 | .t_name = "loopback", | 191 | .t_name = "loopback", |
181 | }; | 192 | }; |
diff --git a/net/rds/message.c b/net/rds/message.c index f681690b2bdc..3ea05c864cd4 100644 --- a/net/rds/message.c +++ b/net/rds/message.c | |||
@@ -89,12 +89,6 @@ void rds_message_put(struct rds_message *rm) | |||
89 | } | 89 | } |
90 | EXPORT_SYMBOL_GPL(rds_message_put); | 90 | EXPORT_SYMBOL_GPL(rds_message_put); |
91 | 91 | ||
92 | void rds_message_inc_free(struct rds_incoming *inc) | ||
93 | { | ||
94 | struct rds_message *rm = container_of(inc, struct rds_message, m_inc); | ||
95 | rds_message_put(rm); | ||
96 | } | ||
97 | |||
98 | void rds_message_populate_header(struct rds_header *hdr, __be16 sport, | 92 | void rds_message_populate_header(struct rds_header *hdr, __be16 sport, |
99 | __be16 dport, u64 seq) | 93 | __be16 dport, u64 seq) |
100 | { | 94 | { |