diff options
| -rw-r--r-- | net/ceph/messenger.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 4f1714c4c93b..2bf9ab4429e6 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -837,7 +837,7 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
| 837 | struct page *page = NULL; | 837 | struct page *page = NULL; |
| 838 | void *kaddr = NULL; | 838 | void *kaddr = NULL; |
| 839 | int max_write = PAGE_SIZE; | 839 | int max_write = PAGE_SIZE; |
| 840 | int page_shift = 0; | 840 | int bio_offset = 0; |
| 841 | 841 | ||
| 842 | total_max_write = data_len - trail_len - | 842 | total_max_write = data_len - trail_len - |
| 843 | con->out_msg_pos.data_pos; | 843 | con->out_msg_pos.data_pos; |
| @@ -874,9 +874,9 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
| 874 | 874 | ||
| 875 | bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg); | 875 | bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg); |
| 876 | page = bv->bv_page; | 876 | page = bv->bv_page; |
| 877 | page_shift = bv->bv_offset; | 877 | bio_offset = bv->bv_offset; |
| 878 | if (do_datacrc) | 878 | if (do_datacrc) |
| 879 | kaddr = kmap(page) + page_shift; | 879 | kaddr = kmap(page); |
| 880 | max_write = bv->bv_len; | 880 | max_write = bv->bv_len; |
| 881 | #endif | 881 | #endif |
| 882 | } else { | 882 | } else { |
| @@ -888,17 +888,18 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
| 888 | total_max_write); | 888 | total_max_write); |
| 889 | 889 | ||
| 890 | if (do_datacrc && !con->out_msg_pos.did_page_crc) { | 890 | if (do_datacrc && !con->out_msg_pos.did_page_crc) { |
| 891 | void *base; | ||
| 891 | u32 crc; | 892 | u32 crc; |
| 892 | void *base = kaddr + con->out_msg_pos.page_pos; | ||
| 893 | u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc); | 893 | u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc); |
| 894 | 894 | ||
| 895 | BUG_ON(kaddr == NULL); | 895 | BUG_ON(kaddr == NULL); |
| 896 | base = kaddr + con->out_msg_pos.page_pos + bio_offset; | ||
| 896 | crc = crc32c(tmpcrc, base, len); | 897 | crc = crc32c(tmpcrc, base, len); |
| 897 | con->out_msg->footer.data_crc = cpu_to_le32(crc); | 898 | con->out_msg->footer.data_crc = cpu_to_le32(crc); |
| 898 | con->out_msg_pos.did_page_crc = true; | 899 | con->out_msg_pos.did_page_crc = true; |
| 899 | } | 900 | } |
| 900 | ret = ceph_tcp_sendpage(con->sock, page, | 901 | ret = ceph_tcp_sendpage(con->sock, page, |
| 901 | con->out_msg_pos.page_pos + page_shift, | 902 | con->out_msg_pos.page_pos + bio_offset, |
| 902 | len, 1); | 903 | len, 1); |
| 903 | 904 | ||
| 904 | if (do_datacrc) | 905 | if (do_datacrc) |
