Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libceph: make ceph_con_get_out_msg() return the message pointer

The caller in messenger_v1.c loads it anyway, so let's keep the
pointer in the register instead of reloading it from memory. This
eliminates a tiny bit of unnecessary overhead.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Max Kellermann and committed by
Ilya Dryomov
59699a5a fbeafe78

+4 -5
+1 -1
include/linux/ceph/messenger.h
··· 550 550 void ceph_con_process_message(struct ceph_connection *con); 551 551 int ceph_con_in_msg_alloc(struct ceph_connection *con, 552 552 struct ceph_msg_header *hdr, int *skip); 553 - void ceph_con_get_out_msg(struct ceph_connection *con); 553 + struct ceph_msg *ceph_con_get_out_msg(struct ceph_connection *con); 554 554 555 555 /* messenger_v1.c */ 556 556 int ceph_con_v1_try_read(struct ceph_connection *con);
+2 -2
net/ceph/messenger.c
··· 2110 2110 return ret; 2111 2111 } 2112 2112 2113 - void ceph_con_get_out_msg(struct ceph_connection *con) 2113 + struct ceph_msg *ceph_con_get_out_msg(struct ceph_connection *con) 2114 2114 { 2115 2115 struct ceph_msg *msg; 2116 2116 ··· 2141 2141 * message or in case of a fault. 2142 2142 */ 2143 2143 WARN_ON(con->out_msg); 2144 - con->out_msg = ceph_msg_get(msg); 2144 + return con->out_msg = ceph_msg_get(msg); 2145 2145 } 2146 2146 2147 2147 /*
+1 -2
net/ceph/messenger_v1.c
··· 210 210 &con->v1.out_temp_ack); 211 211 } 212 212 213 - ceph_con_get_out_msg(con); 214 - m = con->out_msg; 213 + m = ceph_con_get_out_msg(con); 215 214 216 215 dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n", 217 216 m, con->out_seq, le16_to_cpu(m->hdr.type),