aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-04-01 10:48:00 -0400
committerDavid Howells <dhowells@redhat.com>2015-04-01 10:48:00 -0400
commitaab94830a7fdf17aac07fea54d4cb43b0ad001b8 (patch)
treeff11c65eb69d92afe9ac4f265be9c6f64cb864fc /net
parent3af6878ecad229346fbc2c8f2663089aa6aef20d (diff)
RxRPC: Don't call skb_add_data() if there's no data to copy
Don't call skb_add_data() in rxrpc_send_data() if there's no data to copy and also skip the calculations associated with it in such a case. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/rxrpc/ar-output.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c
index 833a33b5c180..f48dc1aa4840 100644
--- a/net/rxrpc/ar-output.c
+++ b/net/rxrpc/ar-output.c
@@ -549,8 +549,6 @@ static int rxrpc_send_data(struct kiocb *iocb,
549 if (len > iov_iter_count(&msg->msg_iter)) 549 if (len > iov_iter_count(&msg->msg_iter))
550 len = iov_iter_count(&msg->msg_iter); 550 len = iov_iter_count(&msg->msg_iter);
551 do { 551 do {
552 int copy;
553
554 if (!skb) { 552 if (!skb) {
555 size_t size, chunk, max, space; 553 size_t size, chunk, max, space;
556 554
@@ -616,23 +614,25 @@ static int rxrpc_send_data(struct kiocb *iocb,
616 sp = rxrpc_skb(skb); 614 sp = rxrpc_skb(skb);
617 615
618 /* append next segment of data to the current buffer */ 616 /* append next segment of data to the current buffer */
619 copy = skb_tailroom(skb); 617 if (len > 0) {
620 ASSERTCMP(copy, >, 0); 618 int copy = skb_tailroom(skb);
621 if (copy > len) 619 ASSERTCMP(copy, >, 0);
622 copy = len; 620 if (copy > len)
623 if (copy > sp->remain) 621 copy = len;
624 copy = sp->remain; 622 if (copy > sp->remain)
625 623 copy = sp->remain;
626 _debug("add"); 624
627 ret = skb_add_data(skb, &msg->msg_iter, copy); 625 _debug("add");
628 _debug("added"); 626 ret = skb_add_data(skb, &msg->msg_iter, copy);
629 if (ret < 0) 627 _debug("added");
630 goto efault; 628 if (ret < 0)
631 sp->remain -= copy; 629 goto efault;
632 skb->mark += copy; 630 sp->remain -= copy;
633 copied += copy; 631 skb->mark += copy;
634 632 copied += copy;
635 len -= copy; 633
634 len -= copy;
635 }
636 636
637 /* check for the far side aborting the call or a network error 637 /* check for the far side aborting the call or a network error
638 * occurring */ 638 * occurring */