Commit f42299e6 authored by Alex Elder's avatar Alex Elder

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: default avatarAlex Elder <elder@dreamhost.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent fe3ad593
...@@ -747,17 +747,18 @@ static int write_partial_kvec(struct ceph_connection *con) ...@@ -747,17 +747,18 @@ static int write_partial_kvec(struct ceph_connection *con)
con->out_kvec_bytes -= ret; con->out_kvec_bytes -= ret;
if (con->out_kvec_bytes == 0) if (con->out_kvec_bytes == 0)
break; /* done */ break; /* done */
while (ret > 0) {
if (ret >= con->out_kvec_cur->iov_len) { /* account for full iov entries consumed */
ret -= con->out_kvec_cur->iov_len; while (ret >= con->out_kvec_cur->iov_len) {
con->out_kvec_cur++; BUG_ON(!con->out_kvec_left);
con->out_kvec_left--; ret -= con->out_kvec_cur->iov_len;
} else { con->out_kvec_cur++;
con->out_kvec_cur->iov_len -= ret; con->out_kvec_left--;
con->out_kvec_cur->iov_base += ret; }
ret = 0; /* and for a partially-consumed entry */
break; if (ret) {
} con->out_kvec_cur->iov_len -= ret;
con->out_kvec_cur->iov_base += ret;
} }
} }
con->out_kvec_left = 0; con->out_kvec_left = 0;
......
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