libceph: Fix ceph_tcp_sendpage()'s more boolean usage
authorBenoît Canet <benoit.canet@nodalink.com>
Thu, 25 Jun 2015 17:32:34 +0000 (20:32 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 29 Jun 2015 17:03:46 +0000 (20:03 +0300)
From struct ceph_msg_data_cursor in include/linux/ceph/messenger.h:

bool    last_piece;     /* current is last piece */

In ceph_msg_data_next():

*last_piece = cursor->last_piece;

A call to ceph_msg_data_next() is followed by:

ret = ceph_tcp_sendpage(con->sock, page, page_offset,
                        length, last_piece);

while ceph_tcp_sendpage() is:

static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
                             int offset, size_t size, bool more)

The logic is inverted: correct it.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/messenger.c

index 38f06a4c3c9e75172edd9343247daebcf39062b6..1441aeff8bd71a011b205fbe496b3440ad497125 100644 (file)
@@ -1544,7 +1544,7 @@ static int write_partial_message_data(struct ceph_connection *con)
                page = ceph_msg_data_next(&msg->cursor, &page_offset, &length,
                                                        &last_piece);
                ret = ceph_tcp_sendpage(con->sock, page, page_offset,
-                                     length, last_piece);
+                                       length, !last_piece);
                if (ret <= 0) {
                        if (do_datacrc)
                                msg->footer.data_crc = cpu_to_le32(crc);