aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-04-01 10:43:26 -0400
committerDavid Howells <dhowells@redhat.com>2015-04-01 10:49:26 -0400
commit382d7974de31ef5e64dceee0d9cada3d3864b767 (patch)
tree6597f5dc2cd2f324ef466a5d9ce234b81231e13a /net
parentaab94830a7fdf17aac07fea54d4cb43b0ad001b8 (diff)
RxRPC: Use iov_iter_count() in rxrpc_send_data() instead of the len argument
Use iov_iter_count() in rxrpc_send_data() to get the remaining data length instead of using the len argument as the len argument is now redundant. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/rxrpc/ar-output.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c
index f48dc1aa4840..de8d2f1b08c5 100644
--- a/net/rxrpc/ar-output.c
+++ b/net/rxrpc/ar-output.c
@@ -546,8 +546,6 @@ static int rxrpc_send_data(struct kiocb *iocb,
546 call->tx_pending = NULL; 546 call->tx_pending = NULL;
547 547
548 copied = 0; 548 copied = 0;
549 if (len > iov_iter_count(&msg->msg_iter))
550 len = iov_iter_count(&msg->msg_iter);
551 do { 549 do {
552 if (!skb) { 550 if (!skb) {
553 size_t size, chunk, max, space; 551 size_t size, chunk, max, space;
@@ -570,8 +568,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
570 max &= ~(call->conn->size_align - 1UL); 568 max &= ~(call->conn->size_align - 1UL);
571 569
572 chunk = max; 570 chunk = max;
573 if (chunk > len && !more) 571 if (chunk > iov_iter_count(&msg->msg_iter) && !more)
574 chunk = len; 572 chunk = iov_iter_count(&msg->msg_iter);
575 573
576 space = chunk + call->conn->size_align; 574 space = chunk + call->conn->size_align;
577 space &= ~(call->conn->size_align - 1UL); 575 space &= ~(call->conn->size_align - 1UL);
@@ -614,11 +612,11 @@ static int rxrpc_send_data(struct kiocb *iocb,
614 sp = rxrpc_skb(skb); 612 sp = rxrpc_skb(skb);
615 613
616 /* append next segment of data to the current buffer */ 614 /* append next segment of data to the current buffer */
617 if (len > 0) { 615 if (iov_iter_count(&msg->msg_iter) > 0) {
618 int copy = skb_tailroom(skb); 616 int copy = skb_tailroom(skb);
619 ASSERTCMP(copy, >, 0); 617 ASSERTCMP(copy, >, 0);
620 if (copy > len) 618 if (copy > iov_iter_count(&msg->msg_iter))
621 copy = len; 619 copy = iov_iter_count(&msg->msg_iter);
622 if (copy > sp->remain) 620 if (copy > sp->remain)
623 copy = sp->remain; 621 copy = sp->remain;
624 622
@@ -630,8 +628,6 @@ static int rxrpc_send_data(struct kiocb *iocb,
630 sp->remain -= copy; 628 sp->remain -= copy;
631 skb->mark += copy; 629 skb->mark += copy;
632 copied += copy; 630 copied += copy;
633
634 len -= copy;
635 } 631 }
636 632
637 /* check for the far side aborting the call or a network error 633 /* check for the far side aborting the call or a network error
@@ -640,7 +636,8 @@ static int rxrpc_send_data(struct kiocb *iocb,
640 goto call_aborted; 636 goto call_aborted;
641 637
642 /* add the packet to the send queue if it's now full */ 638 /* add the packet to the send queue if it's now full */
643 if (sp->remain <= 0 || (!len && !more)) { 639 if (sp->remain <= 0 ||
640 (iov_iter_count(&msg->msg_iter) == 0 && !more)) {
644 struct rxrpc_connection *conn = call->conn; 641 struct rxrpc_connection *conn = call->conn;
645 uint32_t seq; 642 uint32_t seq;
646 size_t pad; 643 size_t pad;
@@ -670,7 +667,7 @@ static int rxrpc_send_data(struct kiocb *iocb,
670 sp->hdr.serviceId = conn->service_id; 667 sp->hdr.serviceId = conn->service_id;
671 668
672 sp->hdr.flags = conn->out_clientflag; 669 sp->hdr.flags = conn->out_clientflag;
673 if (len == 0 && !more) 670 if (iov_iter_count(&msg->msg_iter) == 0 && !more)
674 sp->hdr.flags |= RXRPC_LAST_PACKET; 671 sp->hdr.flags |= RXRPC_LAST_PACKET;
675 else if (CIRC_SPACE(call->acks_head, call->acks_tail, 672 else if (CIRC_SPACE(call->acks_head, call->acks_tail,
676 call->acks_winsz) > 1) 673 call->acks_winsz) > 1)
@@ -686,10 +683,11 @@ static int rxrpc_send_data(struct kiocb *iocb,
686 683
687 memcpy(skb->head, &sp->hdr, 684 memcpy(skb->head, &sp->hdr,
688 sizeof(struct rxrpc_header)); 685 sizeof(struct rxrpc_header));
689 rxrpc_queue_packet(call, skb, !iov_iter_count(&msg->msg_iter) && !more); 686 rxrpc_queue_packet(call, skb,
687 iov_iter_count(&msg->msg_iter) == 0 && !more);
690 skb = NULL; 688 skb = NULL;
691 } 689 }
692 } while (len > 0); 690 } while (iov_iter_count(&msg->msg_iter) > 0);
693 691
694success: 692success:
695 ret = copied; 693 ret = copied;