Commit 9bd19663 authored by Alex Elder's avatar Alex Elder

libceph: rename "page_shift" variable to something sensible

In write_partial_msg_pages() there is a local variable used to
track the starting offset within a bio segment to use.  Its name,
"page_shift" defies the Linux convention of using that name for
log-base-2(page size).

Since it's only used in the bio case rename it "bio_offset".  Use it
along with the page_pos field to compute the memory offset when
computing CRC's in that function.  This makes the bio case match the
others more closely.
Signed-off-by: default avatarAlex Elder <elder@dreamhost.com>
Reviewed-by: default avatarSage Weil <sage@newdream.net>
parent 0cdf9e60
...@@ -837,7 +837,7 @@ static int write_partial_msg_pages(struct ceph_connection *con) ...@@ -837,7 +837,7 @@ static int write_partial_msg_pages(struct ceph_connection *con)
struct page *page = NULL; struct page *page = NULL;
void *kaddr = NULL; void *kaddr = NULL;
int max_write = PAGE_SIZE; int max_write = PAGE_SIZE;
int page_shift = 0; int bio_offset = 0;
total_max_write = data_len - trail_len - total_max_write = data_len - trail_len -
con->out_msg_pos.data_pos; con->out_msg_pos.data_pos;
...@@ -874,9 +874,9 @@ static int write_partial_msg_pages(struct ceph_connection *con) ...@@ -874,9 +874,9 @@ static int write_partial_msg_pages(struct ceph_connection *con)
bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg); bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg);
page = bv->bv_page; page = bv->bv_page;
page_shift = bv->bv_offset; bio_offset = bv->bv_offset;
if (do_datacrc) if (do_datacrc)
kaddr = kmap(page) + page_shift; kaddr = kmap(page);
max_write = bv->bv_len; max_write = bv->bv_len;
#endif #endif
} else { } else {
...@@ -888,17 +888,18 @@ static int write_partial_msg_pages(struct ceph_connection *con) ...@@ -888,17 +888,18 @@ static int write_partial_msg_pages(struct ceph_connection *con)
total_max_write); total_max_write);
if (do_datacrc && !con->out_msg_pos.did_page_crc) { if (do_datacrc && !con->out_msg_pos.did_page_crc) {
void *base;
u32 crc; u32 crc;
void *base = kaddr + con->out_msg_pos.page_pos;
u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc); u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc);
BUG_ON(kaddr == NULL); BUG_ON(kaddr == NULL);
base = kaddr + con->out_msg_pos.page_pos + bio_offset;
crc = crc32c(tmpcrc, base, len); crc = crc32c(tmpcrc, base, len);
con->out_msg->footer.data_crc = cpu_to_le32(crc); con->out_msg->footer.data_crc = cpu_to_le32(crc);
con->out_msg_pos.did_page_crc = true; con->out_msg_pos.did_page_crc = true;
} }
ret = ceph_tcp_sendpage(con->sock, page, ret = ceph_tcp_sendpage(con->sock, page,
con->out_msg_pos.page_pos + page_shift, con->out_msg_pos.page_pos + bio_offset,
len, 1); len, 1);
if (do_datacrc) if (do_datacrc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment