All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 4/4] libceph: use only ceph_msg_data_advance()
Date: Tue, 12 Mar 2013 20:09:58 -0500	[thread overview]
Message-ID: <513FD1E6.2090104@inktank.com> (raw)
In-Reply-To: <513FD178.60207@inktank.com>

The *_msg_pos_next() functions do little more than call
ceph_msg_data_advance().  Replace those wrapper functions with
a simple call to ceph_msg_data_advance().

This cleanup is related to:
    http://tracker.ceph.com/issues/4428

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/messenger.c |   39 +++------------------------------------
 1 file changed, 3 insertions(+), 36 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 3180f82..8e07ac4 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1365,40 +1365,6 @@ out:
 	return ret;  /* done! */
 }

-static void out_msg_pos_next(struct ceph_connection *con, struct page
*page,
-			size_t len, size_t sent)
-{
-	struct ceph_msg *msg = con->out_msg;
-	bool need_crc = false;
-
-	BUG_ON(!msg);
-	BUG_ON(!sent);
-
-	need_crc = ceph_msg_data_advance(&msg->data, sent);
-	BUG_ON(need_crc && sent != len);
-
-	if (sent < len)
-		return;
-
-	BUG_ON(sent != len);
-}
-
-static void in_msg_pos_next(struct ceph_connection *con, size_t len,
-				size_t received)
-{
-	struct ceph_msg *msg = con->in_msg;
-
-	BUG_ON(!msg);
-	BUG_ON(!received);
-
-	(void) ceph_msg_data_advance(&msg->data, received);
-
-	if (received < len)
-		return;
-
-	BUG_ON(received != len);
-}
-
 static u32 ceph_crc32c_page(u32 crc, struct page *page,
 				unsigned int page_offset,
 				unsigned int length)
@@ -1445,6 +1411,7 @@ static int write_partial_message_data(struct
ceph_connection *con)
 		size_t page_offset;
 		size_t length;
 		bool last_piece;
+		bool need_crc;
 		int ret;

 		page = ceph_msg_data_next(&msg->data, &page_offset, &length,
@@ -1458,7 +1425,7 @@ static int write_partial_message_data(struct
ceph_connection *con)

 			return ret;
 		}
-		out_msg_pos_next(con, page, length, (size_t) ret);
+		need_crc = ceph_msg_data_advance(&msg->data, (size_t) ret);
 	}
 	msg->footer.data_crc = cpu_to_le32(crc);

@@ -2133,7 +2100,7 @@ static int read_partial_msg_data(struct
ceph_connection *con)

 		if (do_datacrc)
 			crc = ceph_crc32c_page(crc, page, page_offset, ret);
-		in_msg_pos_next(con, length, ret);
+		(void) ceph_msg_data_advance(&msg->data, (size_t) ret);
 	}
 	con->in_data_crc = crc;

-- 
1.7.9.5


  parent reply	other threads:[~2013-03-13  1:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13  1:08 [PATCH 0/4] libceph: get rid of ceph_msg_pos Alex Elder
2013-03-13  1:09 ` [PATCH 1/4] libceph: use cursor resid for loop condition Alex Elder
2013-03-13  1:09 ` [PATCH 2/4] libceph: kill most of ceph_msg_pos Alex Elder
2013-03-13  1:09 ` [PATCH 3/4] libceph: kill last " Alex Elder
2013-03-13  1:09 ` Alex Elder [this message]
2013-03-14 19:54 ` [PATCH 0/4] libceph: get rid " Josh Durgin

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=513FD1E6.2090104@inktank.com \
    --to=elder@inktank.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.