All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@dreamhost.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/5] libceph: rename "page_shift" variable to something sensible
Date: Mon, 12 Mar 2012 17:40:26 -0500	[thread overview]
Message-ID: <4F5E7B5A.8090809@dreamhost.com> (raw)
In-Reply-To: <4F5E79C6.6040301@dreamhost.com>

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: Alex Elder <elder@dreamhost.com>
---
  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 4f1714c..2bf9ab4 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)
  		struct page *page = NULL;
  		void *kaddr = NULL;
  		int max_write = PAGE_SIZE;
-		int page_shift = 0;
+		int bio_offset = 0;

  		total_max_write = data_len - trail_len -
  			con->out_msg_pos.data_pos;
@@ -874,9 +874,9 @@ static int write_partial_msg_pages(struct 
ceph_connection *con)

  			bv = bio_iovec_idx(msg->bio_iter, msg->bio_seg);
  			page = bv->bv_page;
-			page_shift = bv->bv_offset;
+			bio_offset = bv->bv_offset;
  			if (do_datacrc)
-				kaddr = kmap(page) + page_shift;
+				kaddr = kmap(page);
  			max_write = bv->bv_len;
  #endif
  		} else {
@@ -888,17 +888,18 @@ static int write_partial_msg_pages(struct 
ceph_connection *con)
  			    total_max_write);

  		if (do_datacrc && !con->out_msg_pos.did_page_crc) {
+			void *base;
  			u32 crc;
-			void *base = kaddr + con->out_msg_pos.page_pos;
  			u32 tmpcrc = le32_to_cpu(con->out_msg->footer.data_crc);

  			BUG_ON(kaddr == NULL);
+			base = kaddr + con->out_msg_pos.page_pos + bio_offset;
  			crc = crc32c(tmpcrc, base, len);
  			con->out_msg->footer.data_crc = cpu_to_le32(crc);
  			con->out_msg_pos.did_page_crc = true;
  		}
  		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);

  		if (do_datacrc)
-- 
1.7.5.4


  parent reply	other threads:[~2012-03-12 22:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 22:33 [PATCH 0/5] libceph: page mapping in the messenger Alex Elder
2012-03-12 22:40 ` [PATCH 1/5] libceph: use kernel_sendpage() for sending zeroes Alex Elder
2012-03-12 22:40 ` [PATCH 2/5] libceph: only call kernel_sendpage() via helper Alex Elder
2012-03-12 22:40 ` [PATCH 3/5] libceph: get rid of zero_page_address Alex Elder
2012-03-12 22:40 ` Alex Elder [this message]
2012-03-12 22:40 ` [PATCH 5/5] libceph: isolate kmap() call in write_partial_msg_pages() Alex Elder
2012-03-13  5:31 ` [PATCH 0/5] libceph: page mapping in the messenger Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F5E7B5A.8090809@dreamhost.com \
    --to=elder@dreamhost.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.