Skip to content

Commit 59699a5

Browse files
MaxKellermannidryomov
authored andcommitted
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 <[email protected]> Reviewed-by: Viacheslav Dubeyko <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent fbeafe7 commit 59699a5

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

include/linux/ceph/messenger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ void ceph_addr_set_port(struct ceph_entity_addr *addr, int p);
550550
void ceph_con_process_message(struct ceph_connection *con);
551551
int ceph_con_in_msg_alloc(struct ceph_connection *con,
552552
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);
554554

555555
/* messenger_v1.c */
556556
int ceph_con_v1_try_read(struct ceph_connection *con);

net/ceph/messenger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ int ceph_con_in_msg_alloc(struct ceph_connection *con,
21102110
return ret;
21112111
}
21122112

2113-
void ceph_con_get_out_msg(struct ceph_connection *con)
2113+
struct ceph_msg *ceph_con_get_out_msg(struct ceph_connection *con)
21142114
{
21152115
struct ceph_msg *msg;
21162116

@@ -2141,7 +2141,7 @@ void ceph_con_get_out_msg(struct ceph_connection *con)
21412141
* message or in case of a fault.
21422142
*/
21432143
WARN_ON(con->out_msg);
2144-
con->out_msg = ceph_msg_get(msg);
2144+
return con->out_msg = ceph_msg_get(msg);
21452145
}
21462146

21472147
/*

net/ceph/messenger_v1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ static void prepare_write_message(struct ceph_connection *con)
210210
&con->v1.out_temp_ack);
211211
}
212212

213-
ceph_con_get_out_msg(con);
214-
m = con->out_msg;
213+
m = ceph_con_get_out_msg(con);
215214

216215
dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n",
217216
m, con->out_seq, le16_to_cpu(m->hdr.type),

0 commit comments

Comments
 (0)