Skip to contentSkip to conversation

net: ceph: messenger: Use local variable cursor instead of &msg->cursor

PATCH Applied Shraddha Barke 2 participants 2 messages Oct 19, 2015 Ceph common code (libceph)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: ceph: messenger: Use local variable cursor instead of &msg->cursor

Use local variable cursor in place of &msg->cursor in read_partial_msg_data() and write_partial_msg_data()

---
Changes in v3-
Replace &msg->cursor with cursor in write_partial_msg_data() too

 net/ceph/messenger.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
net/ceph/messenger.c +6 -6
index b9b0e3b..01b567b 100644
@@ -1552,8 +1552,8 @@ static int write_partial_message_data(struct ceph_connection *con)
 		bool need_crc;
 		int ret;
 
-		page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
-							&last_piece);
+		page = ceph_msg_data_next(cursor, &page_offset, &length,
+						  &last_piece);
 		ret = ceph_tcp_sendpage(con->sock, page, page_offset,
 					length, !last_piece);
 		if (ret <= 0) {
@@ -1564,7 +1564,7 @@ static int write_partial_message_data(struct ceph_connection *con)
 		}
 		if (do_datacrc && cursor->need_crc)
 			crc = ceph_crc32c_page(crc, page, page_offset, length);
-		need_crc = ceph_msg_data_advance(&msg->cursor, (size_t)ret);
+		need_crc = ceph_msg_data_advance(cursor, (size_t)ret);
 	}
 
 	dout("%s %p msg %p done\n", __func__, con, msg);
@@ -2246,8 +2246,8 @@ static int read_partial_msg_data(struct ceph_connection *con)
 	if (do_datacrc)
 		crc = con->in_data_crc;
 	while (cursor->resid) {
-		page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
-							NULL);
+		page = ceph_msg_data_next(cursor, &page_offset, &length,
+						  NULL);
 		ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
 		if (ret <= 0) {
 			if (do_datacrc)
@@ -2258,7 +2258,7 @@ static int read_partial_msg_data(struct ceph_connection *con)
 
 		if (do_datacrc)
 			crc = ceph_crc32c_page(crc, page, page_offset, ret);
-		(void) ceph_msg_data_advance(&msg->cursor, (size_t)ret);
+		(void) ceph_msg_data_advance(cursor, (size_t)ret);
 	}
 	if (do_datacrc)
 		con->in_data_crc = crc;
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw
Quoted 47 lines · Shraddha Barke

Use local variable cursor in place of &msg->cursor in read_partial_msg_data() and write_partial_msg_data()

---
Changes in v3-
Replace &msg->cursor with cursor in write_partial_msg_data() too

 net/ceph/messenger.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
net/ceph/messenger.c +5 -5
index b9b0e3b..01b567b 100644
@@ -1552,8 +1552,8 @@ static int write_partial_message_data(struct ceph_connection *con)
                bool need_crc;
                int ret;
 
-               page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
-                                                       &last_piece);
+               page = ceph_msg_data_next(cursor, &page_offset, &length,
+                                                 &last_piece);
                ret = ceph_tcp_sendpage(con->sock, page, page_offset,
                                        length, !last_piece);
                if (ret <= 0) {
@@ -1564,7 +1564,7 @@ static int write_partial_message_data(struct ceph_connection *con)
                }
                if (do_datacrc && cursor->need_crc)
                        crc = ceph_crc32c_page(crc, page, page_offset, length);
-               need_crc = ceph_msg_data_advance(&msg->cursor, (size_t)ret);
+               need_crc = ceph_msg_data_advance(cursor, (size_t)ret);
        }
 
        dout("%s %p msg %p done\n", __func__, con, msg);
@@ -2246,8 +2246,8 @@ static int read_partial_msg_data(struct ceph_connection *con)
        if (do_datacrc)
                crc = con->in_data_crc;
        while (cursor->resid) {
-               page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
-                                                       NULL);
+               page = ceph_msg_data_next(cursor, &page_offset, &length,
+                                                 NULL);
                ret = ceph_tcp_recvpage(con->sock, page, page_offset, length);
                if (ret <= 0) {
                        if (do_datacrc)

net/ceph/messenger.c static int read_partial_msg_data(struct ceph_connection *con) · line 2264

Quoted 8 lines
net/ceph/messenger.c +1 -1
@@ -2258,7 +2258,7 @@ static int read_partial_msg_data(struct ceph_connection *con)
 
                if (do_datacrc)
                        crc = ceph_crc32c_page(crc, page, page_offset, ret);
-               (void) ceph_msg_data_advance(&msg->cursor, (size_t)ret);
+               (void) ceph_msg_data_advance(cursor, (size_t)ret);
        }
        if (do_datacrc)
                con->in_data_crc = crc;

Applied, see
https://github.com/ceph/ceph-client/commit/621a56fd69751d263795f4f35e65eff7daa3a470.

Generally, we prefix net/ceph commits with "libceph". Different subsystems have different conventions, use "git log --oneline <path>" to get a sense of what is preferred.

Thanks,

Ilya