diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2015-10-28 18:50:58 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-11-02 17:37:46 -0500 |
commit | 859bff51dc5e92ddfb5eb6f17b8040d9311095bb (patch) | |
tree | ff5fb0d52e36de7417410cfb63424066da56ba1f /net/ceph | |
parent | 4199b8eec36405822619d4176bddfacf7b47eb44 (diff) |
libceph: stop duplicating client fields in messenger
supported_features and required_features serve no purpose at all, while
nocrc and tcp_nodelay belong to ceph_options::flags.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/ceph_common.c | 6 | ||||
-rw-r--r-- | net/ceph/messenger.c | 26 |
2 files changed, 10 insertions, 22 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 54a00d66509e..d1494d1a8592 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -596,11 +596,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, | |||
596 | if (ceph_test_opt(client, MYIP)) | 596 | if (ceph_test_opt(client, MYIP)) |
597 | myaddr = &client->options->my_addr; | 597 | myaddr = &client->options->my_addr; |
598 | 598 | ||
599 | ceph_messenger_init(&client->msgr, myaddr, | 599 | ceph_messenger_init(&client->msgr, myaddr); |
600 | client->supported_features, | ||
601 | client->required_features, | ||
602 | ceph_test_opt(client, NOCRC), | ||
603 | ceph_test_opt(client, TCP_NODELAY)); | ||
604 | 600 | ||
605 | /* subsystems */ | 601 | /* subsystems */ |
606 | err = ceph_monc_init(&client->monc, client); | 602 | err = ceph_monc_init(&client->monc, client); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 805f6f82139f..11108076bac3 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -509,7 +509,7 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
509 | return ret; | 509 | return ret; |
510 | } | 510 | } |
511 | 511 | ||
512 | if (con->msgr->tcp_nodelay) { | 512 | if (ceph_test_opt(from_msgr(con->msgr), TCP_NODELAY)) { |
513 | int optval = 1; | 513 | int optval = 1; |
514 | 514 | ||
515 | ret = kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, | 515 | ret = kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, |
@@ -1432,7 +1432,8 @@ static int prepare_write_connect(struct ceph_connection *con) | |||
1432 | dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con, | 1432 | dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con, |
1433 | con->connect_seq, global_seq, proto); | 1433 | con->connect_seq, global_seq, proto); |
1434 | 1434 | ||
1435 | con->out_connect.features = cpu_to_le64(con->msgr->supported_features); | 1435 | con->out_connect.features = |
1436 | cpu_to_le64(from_msgr(con->msgr)->supported_features); | ||
1436 | con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); | 1437 | con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); |
1437 | con->out_connect.connect_seq = cpu_to_le32(con->connect_seq); | 1438 | con->out_connect.connect_seq = cpu_to_le32(con->connect_seq); |
1438 | con->out_connect.global_seq = cpu_to_le32(global_seq); | 1439 | con->out_connect.global_seq = cpu_to_le32(global_seq); |
@@ -1527,7 +1528,7 @@ static int write_partial_message_data(struct ceph_connection *con) | |||
1527 | { | 1528 | { |
1528 | struct ceph_msg *msg = con->out_msg; | 1529 | struct ceph_msg *msg = con->out_msg; |
1529 | struct ceph_msg_data_cursor *cursor = &msg->cursor; | 1530 | struct ceph_msg_data_cursor *cursor = &msg->cursor; |
1530 | bool do_datacrc = !con->msgr->nocrc; | 1531 | bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC); |
1531 | u32 crc; | 1532 | u32 crc; |
1532 | 1533 | ||
1533 | dout("%s %p msg %p\n", __func__, con, msg); | 1534 | dout("%s %p msg %p\n", __func__, con, msg); |
@@ -2005,8 +2006,8 @@ static int process_banner(struct ceph_connection *con) | |||
2005 | 2006 | ||
2006 | static int process_connect(struct ceph_connection *con) | 2007 | static int process_connect(struct ceph_connection *con) |
2007 | { | 2008 | { |
2008 | u64 sup_feat = con->msgr->supported_features; | 2009 | u64 sup_feat = from_msgr(con->msgr)->supported_features; |
2009 | u64 req_feat = con->msgr->required_features; | 2010 | u64 req_feat = from_msgr(con->msgr)->required_features; |
2010 | u64 server_feat = ceph_sanitize_features( | 2011 | u64 server_feat = ceph_sanitize_features( |
2011 | le64_to_cpu(con->in_reply.features)); | 2012 | le64_to_cpu(con->in_reply.features)); |
2012 | int ret; | 2013 | int ret; |
@@ -2232,7 +2233,7 @@ static int read_partial_msg_data(struct ceph_connection *con) | |||
2232 | { | 2233 | { |
2233 | struct ceph_msg *msg = con->in_msg; | 2234 | struct ceph_msg *msg = con->in_msg; |
2234 | struct ceph_msg_data_cursor *cursor = &msg->cursor; | 2235 | struct ceph_msg_data_cursor *cursor = &msg->cursor; |
2235 | const bool do_datacrc = !con->msgr->nocrc; | 2236 | bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC); |
2236 | struct page *page; | 2237 | struct page *page; |
2237 | size_t page_offset; | 2238 | size_t page_offset; |
2238 | size_t length; | 2239 | size_t length; |
@@ -2277,7 +2278,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
2277 | int end; | 2278 | int end; |
2278 | int ret; | 2279 | int ret; |
2279 | unsigned int front_len, middle_len, data_len; | 2280 | unsigned int front_len, middle_len, data_len; |
2280 | bool do_datacrc = !con->msgr->nocrc; | 2281 | bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC); |
2281 | bool need_sign = (con->peer_features & CEPH_FEATURE_MSG_AUTH); | 2282 | bool need_sign = (con->peer_features & CEPH_FEATURE_MSG_AUTH); |
2282 | u64 seq; | 2283 | u64 seq; |
2283 | u32 crc; | 2284 | u32 crc; |
@@ -2951,15 +2952,8 @@ static void con_fault(struct ceph_connection *con) | |||
2951 | * initialize a new messenger instance | 2952 | * initialize a new messenger instance |
2952 | */ | 2953 | */ |
2953 | void ceph_messenger_init(struct ceph_messenger *msgr, | 2954 | void ceph_messenger_init(struct ceph_messenger *msgr, |
2954 | struct ceph_entity_addr *myaddr, | 2955 | struct ceph_entity_addr *myaddr) |
2955 | u64 supported_features, | ||
2956 | u64 required_features, | ||
2957 | bool nocrc, | ||
2958 | bool tcp_nodelay) | ||
2959 | { | 2956 | { |
2960 | msgr->supported_features = supported_features; | ||
2961 | msgr->required_features = required_features; | ||
2962 | |||
2963 | spin_lock_init(&msgr->global_seq_lock); | 2957 | spin_lock_init(&msgr->global_seq_lock); |
2964 | 2958 | ||
2965 | if (myaddr) | 2959 | if (myaddr) |
@@ -2969,8 +2963,6 @@ void ceph_messenger_init(struct ceph_messenger *msgr, | |||
2969 | msgr->inst.addr.type = 0; | 2963 | msgr->inst.addr.type = 0; |
2970 | get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); | 2964 | get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); |
2971 | encode_my_addr(msgr); | 2965 | encode_my_addr(msgr); |
2972 | msgr->nocrc = nocrc; | ||
2973 | msgr->tcp_nodelay = tcp_nodelay; | ||
2974 | 2966 | ||
2975 | atomic_set(&msgr->stopping, 0); | 2967 | atomic_set(&msgr->stopping, 0); |
2976 | write_pnet(&msgr->net, get_net(current->nsproxy->net_ns)); | 2968 | write_pnet(&msgr->net, get_net(current->nsproxy->net_ns)); |