]> www.infradead.org Git - users/hch/misc.git/commitdiff
libceph: make ceph_con_get_out_msg() return the message pointer
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 6 Aug 2025 09:48:53 +0000 (11:48 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 8 Oct 2025 21:30:46 +0000 (23:30 +0200)
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>
include/linux/ceph/messenger.h
net/ceph/messenger.c
net/ceph/messenger_v1.c

index 4b49592a738fc3a6c4b91d7a1f771af94398620a..9ebcac2981fd4d35a654caf86fb2a1d2650c1dde 100644 (file)
@@ -550,7 +550,7 @@ void ceph_addr_set_port(struct ceph_entity_addr *addr, int p);
 void ceph_con_process_message(struct ceph_connection *con);
 int ceph_con_in_msg_alloc(struct ceph_connection *con,
                          struct ceph_msg_header *hdr, int *skip);
-void ceph_con_get_out_msg(struct ceph_connection *con);
+struct ceph_msg *ceph_con_get_out_msg(struct ceph_connection *con);
 
 /* messenger_v1.c */
 int ceph_con_v1_try_read(struct ceph_connection *con);
index 9f6d860411cbd114c26332e78fb7e46bfedb6add..b6c7bfc0350361a799cbfd1d894a8eb54ab50719 100644 (file)
@@ -2110,7 +2110,7 @@ int ceph_con_in_msg_alloc(struct ceph_connection *con,
        return ret;
 }
 
-void ceph_con_get_out_msg(struct ceph_connection *con)
+struct ceph_msg *ceph_con_get_out_msg(struct ceph_connection *con)
 {
        struct ceph_msg *msg;
 
@@ -2141,7 +2141,7 @@ void ceph_con_get_out_msg(struct ceph_connection *con)
         * message or in case of a fault.
         */
        WARN_ON(con->out_msg);
-       con->out_msg = ceph_msg_get(msg);
+       return con->out_msg = ceph_msg_get(msg);
 }
 
 /*
index 0cb61c76b9b87da0746294cb371bc62defec0f81..eebe4e19d75afc46a143d577d4bd580b1aa51164 100644 (file)
@@ -210,8 +210,7 @@ static void prepare_write_message(struct ceph_connection *con)
                        &con->v1.out_temp_ack);
        }
 
-       ceph_con_get_out_msg(con);
-       m = con->out_msg;
+       m = ceph_con_get_out_msg(con);
 
        dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n",
             m, con->out_seq, le16_to_cpu(m->hdr.type),