From patchwork Mon Jul 14 09:01:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 4543591 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6796E9F1D6 for ; Mon, 14 Jul 2014 09:01:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D1922012B for ; Mon, 14 Jul 2014 09:01:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B19E2010F for ; Mon, 14 Jul 2014 09:01:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751282AbaGNJBb (ORCPT ); Mon, 14 Jul 2014 05:01:31 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:39995 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbaGNJBa (ORCPT ); Mon, 14 Jul 2014 05:01:30 -0400 Received: by mail-la0-f52.google.com with SMTP id e16so1067911lan.25 for ; Mon, 14 Jul 2014 02:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=FK0hWf9NswZTvm7PC8V0egikkh1k1RtAqoDUNegIDBQ=; b=b9+HxGk6sOe5En0lkrPqASQg4kOEeK+TVq5l8OSrVoAdTgA7BRVU8uDfV2hB6A2xPa w7hdelD8qmoKwJFvJNKmIQmS3ubcNK65zqjxuMWNalAFM4Cl0WIyaSF7fc4bCh01YFlM xwbMMIJpXG4NxJeMrJtqJWnLQjFsZDFttPI9jjadhFnI9NLX6+FL9Wj/xvOsW+gauIMG P4J3HKHYRJIZaTB2eLfIm4c/+Hm6B/HlFVuHnkH4Pi/FFatlgKCJz3pEol8Zy8/Fy3gN St6nR5+sci4YmfLOZuvBiMfbLFlEKGe5hyCKaz81vx+0ABal9f8XAa1+IGmTtycjqpLx zGjA== X-Received: by 10.152.44.233 with SMTP id h9mr1228727lam.58.1405328489619; Mon, 14 Jul 2014 02:01:29 -0700 (PDT) Received: from localhost.localdomain ([92.43.3.85]) by mx.google.com with ESMTPSA id r2sm5063434lag.27.2014.07.14.02.01.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 02:01:28 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH v2 3/7] CIFS: Count got bytes in read_into_pages() Date: Mon, 14 Jul 2014 13:01:13 +0400 Message-Id: <1405328477-13484-4-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1405328477-13484-1-git-send-email-pshilovsky@samba.org> References: <1405328477-13484-1-git-send-email-pshilovsky@samba.org> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP that let us know how many bytes we have already got before reconnect. Signed-off-by: Pavel Shilovsky --- fs/cifs/cifssmb.c | 1 - fs/cifs/file.c | 16 ++++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index a3e424d..5d6768f 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -1513,7 +1513,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) return length; server->total_read += length; - rdata->got_bytes = length; cifs_dbg(FYI, "total_read=%u buflen=%u remaining=%u\n", server->total_read, buflen, data_len); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7fc9bdc..f6cb765 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2867,11 +2867,12 @@ static int cifs_uncached_read_into_pages(struct TCP_Server_Info *server, struct cifs_readdata *rdata, unsigned int len) { - int total_read = 0, result = 0; + int result = 0; unsigned int i; unsigned int nr_pages = rdata->nr_pages; struct kvec iov; + rdata->got_bytes = 0; rdata->tailsz = PAGE_SIZE; for (i = 0; i < nr_pages; i++) { struct page *page = rdata->pages[i]; @@ -2905,10 +2906,11 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server, if (result < 0) break; - total_read += result; + rdata->got_bytes += result; } - return total_read > 0 && result != -ECONNABORTED ? total_read : result; + return rdata->got_bytes > 0 && result != -ECONNABORTED ? + rdata->got_bytes : result; } static int @@ -3289,7 +3291,7 @@ static int cifs_readpages_read_into_pages(struct TCP_Server_Info *server, struct cifs_readdata *rdata, unsigned int len) { - int total_read = 0, result = 0; + int result = 0; unsigned int i; u64 eof; pgoff_t eof_index; @@ -3301,6 +3303,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server, eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0; cifs_dbg(FYI, "eof=%llu eof_index=%lu\n", eof, eof_index); + rdata->got_bytes = 0; rdata->tailsz = PAGE_CACHE_SIZE; for (i = 0; i < nr_pages; i++) { struct page *page = rdata->pages[i]; @@ -3355,10 +3358,11 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server, if (result < 0) break; - total_read += result; + rdata->got_bytes += result; } - return total_read > 0 && result != -ECONNABORTED ? total_read : result; + return rdata->got_bytes > 0 && result != -ECONNABORTED ? + rdata->got_bytes : result; } static int