summaryrefslogtreecommitdiff
path: root/net/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-02-15 07:43:55 -0600
committerAlex Elder <elder@dreamhost.com>2012-03-22 10:47:51 -0500
commit84495f496170a73ed79667b7fbf91947b7f47c87 (patch)
treec36204466b0dc85b39c187f78275c3b25925b15c /net/ceph
parentf42299e6c3883c69c14079b8c88fe33815b2dcc3 (diff)
libceph: some simple changes
Nothing too big here. - define the size of the buffer used for consuming ignored incoming data using a symbolic constant - simplify the condition determining whether to unmap the page in write_partial_msg_pages(): do it for crc but not if the page is the zero page Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/messenger.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index e8f236e87f38..1a22975945da 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -38,6 +38,11 @@ static char tag_keepalive = CEPH_MSGR_TAG_KEEPALIVE;
static struct lock_class_key socket_class;
#endif
+/*
+ * When skipping (ignoring) a block of input we read it into a "skip
+ * buffer," which is this many bytes in size.
+ */
+#define SKIP_BUF_SIZE 1024
static void queue_con(struct ceph_connection *con);
static void con_work(struct work_struct *);
@@ -892,8 +897,7 @@ static int write_partial_msg_pages(struct ceph_connection *con)
MSG_DONTWAIT | MSG_NOSIGNAL |
MSG_MORE);
- if (do_crc &&
- (msg->pages || msg->pagelist || msg->bio || in_trail))
+ if (do_crc && kaddr != zero_page_address)
kunmap(page);
if (ret == -EAGAIN)
@@ -1982,8 +1986,9 @@ more:
*
* FIXME: there must be a better way to do this!
*/
- static char buf[1024];
- int skip = min(1024, -con->in_base_pos);
+ static char buf[SKIP_BUF_SIZE];
+ int skip = min((int) sizeof (buf), -con->in_base_pos);
+
dout("skipping %d / %d bytes\n", skip, -con->in_base_pos);
ret = ceph_tcp_recvmsg(con->sock, buf, skip);
if (ret <= 0)