summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-02-15 07:43:54 -0600
committerAlex Elder <elder@dreamhost.com>2012-03-22 10:47:51 -0500
commitf42299e6c3883c69c14079b8c88fe33815b2dcc3 (patch)
treef94d09a6438705bff01311dbe7cd426d1a800ff5 /net
parentfe3ad593e2c34457ffa6233014ab19f4d36f85f2 (diff)
downloadblackbird-op-linux-f42299e6c3883c69c14079b8c88fe33815b2dcc3.tar.gz
blackbird-op-linux-f42299e6c3883c69c14079b8c88fe33815b2dcc3.zip
libceph: small refactor in write_partial_kvec()
Make a small change in the code that counts down kvecs consumed by a ceph_tcp_sendmsg() call. Same functionality, just blocked out a little differently. Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 575511a29eb7..e8f236e87f38 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -747,17 +747,18 @@ static int write_partial_kvec(struct ceph_connection *con)
con->out_kvec_bytes -= ret;
if (con->out_kvec_bytes == 0)
break; /* done */
- while (ret > 0) {
- if (ret >= con->out_kvec_cur->iov_len) {
- ret -= con->out_kvec_cur->iov_len;
- con->out_kvec_cur++;
- con->out_kvec_left--;
- } else {
- con->out_kvec_cur->iov_len -= ret;
- con->out_kvec_cur->iov_base += ret;
- ret = 0;
- break;
- }
+
+ /* account for full iov entries consumed */
+ while (ret >= con->out_kvec_cur->iov_len) {
+ BUG_ON(!con->out_kvec_left);
+ ret -= con->out_kvec_cur->iov_len;
+ con->out_kvec_cur++;
+ con->out_kvec_left--;
+ }
+ /* and for a partially-consumed entry */
+ if (ret) {
+ con->out_kvec_cur->iov_len -= ret;
+ con->out_kvec_cur->iov_base += ret;
}
}
con->out_kvec_left = 0;
OpenPOWER on IntegriCloud