diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2014-03-12 11:31:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-12 15:53:49 -0400 |
commit | 3b4f302d85785bb1c99b3db7f9557b256baa3805 (patch) | |
tree | f7ae25914a547b93851fc7aef94fc2daf601cc95 /net/tipc/socket.c | |
parent | 24be34b5a0c9114541891d29dff1152bb1a8df34 (diff) | |
download | linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.tar.gz linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.tar.bz2 linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.zip |
tipc: eliminate redundant locking
The three functions tipc_portimportance(), tipc_portunreliable() and
tipc_portunreturnable() and their corresponding tipc_set* functions,
are all grabbing port_lock when accessing the targeted port. This is
unnecessary in the current code, since these calls only are made from
within socket downcalls, already protected by sock_lock.
We remove the redundant locking. Also, since the functions now become
trivial one-liners, we move them to port.h and make them inline.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index d147eaaa6d58..6c7198829805 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -197,9 +197,9 @@ static int tipc_sk_create(struct net *net, struct socket *sock, int protocol, spin_unlock_bh(tp_ptr->lock); if (sock->state == SS_READY) { - tipc_set_portunreturnable(tp_ptr->ref, 1); + tipc_port_set_unreturnable(tp_ptr, true); if (sock->type == SOCK_DGRAM) - tipc_set_portunreliable(tp_ptr->ref, 1); + tipc_port_set_unreliable(tp_ptr, true); } return 0; } @@ -1675,7 +1675,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags) tipc_port_connect(new_ref, &peer); new_sock->state = SS_CONNECTED; - tipc_set_portimportance(new_ref, msg_importance(msg)); + tipc_port_set_importance(new_port, msg_importance(msg)); if (msg_named(msg)) { new_port->conn_type = msg_nametype(msg); new_port->conn_instance = msg_nameinst(msg); @@ -1797,16 +1797,16 @@ static int tipc_setsockopt(struct socket *sock, int lvl, int opt, switch (opt) { case TIPC_IMPORTANCE: - res = tipc_set_portimportance(tport->ref, value); + tipc_port_set_importance(tport, value); break; case TIPC_SRC_DROPPABLE: if (sock->type != SOCK_STREAM) - res = tipc_set_portunreliable(tport->ref, value); + tipc_port_set_unreliable(tport, value); else res = -ENOPROTOOPT; break; case TIPC_DEST_DROPPABLE: - res = tipc_set_portunreturnable(tport->ref, value); + tipc_port_set_unreturnable(tport, value); break; case TIPC_CONN_TIMEOUT: tipc_sk(sk)->conn_timeout = value; @@ -1855,13 +1855,13 @@ static int tipc_getsockopt(struct socket *sock, int lvl, int opt, switch (opt) { case TIPC_IMPORTANCE: - res = tipc_portimportance(tport->ref, &value); + value = tipc_port_importance(tport); break; case TIPC_SRC_DROPPABLE: - res = tipc_portunreliable(tport->ref, &value); + value = tipc_port_unreliable(tport); break; case TIPC_DEST_DROPPABLE: - res = tipc_portunreturnable(tport->ref, &value); + value = tipc_port_unreturnable(tport); break; case TIPC_CONN_TIMEOUT: value = tipc_sk(sk)->conn_timeout; |