From patchwork Thu Jul 10 09:30:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 4522401 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1CF26BEEAA for ; Thu, 10 Jul 2014 09:31:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 471EB2021B for ; Thu, 10 Jul 2014 09:31:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AE6620200 for ; Thu, 10 Jul 2014 09:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbaGJJbD (ORCPT ); Thu, 10 Jul 2014 05:31:03 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:52921 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbaGJJbB (ORCPT ); Thu, 10 Jul 2014 05:31:01 -0400 Received: by mail-la0-f52.google.com with SMTP id gl10so544850lab.11 for ; Thu, 10 Jul 2014 02:31:00 -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=Tfi26xjd7b6CDjJmdkMtKGW4zy+XddDmSyhW8LyUpTA=; b=N9W2WQvVaR8wO7DyTRy9Zp6oqCulqdBXxDeyQ29dlX0RSNFCzOxwHqTZ9H/RrwiVOZ 3BJIzlw1a72/bRwpUiPbsdyetHdw7+Xf8bx3upSB9SKqmzHTLIEIsUANk911DykQniZi u7i+WwkkMUZs1/Fi8cwJ5qAASBtq7PZ4A+HFXTcOlmEdxUNmBhsc4HUSau5btVRqy2PI l6/VPHgtzXUw8IVakaG9D/Emao3FucaGV8GQ2DosqxkgUysewBuVUHonXAjrfqUe1UA1 h8ou1dHrZgJgSvbjTMDvXdq4H4ZxLRxR+AV0bv8+rvzwrz0tYslRcH0XZ/I/y3IdKoMr R5cQ== X-Received: by 10.112.136.164 with SMTP id qb4mr2373127lbb.61.1404984660471; Thu, 10 Jul 2014 02:31:00 -0700 (PDT) Received: from localhost.localdomain ([92.43.3.36]) by mx.google.com with ESMTPSA id v6sm23257226lal.35.2014.07.10.02.30.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jul 2014 02:30:59 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 3/7] CIFS: Count got bytes in read_into_pages() Date: Thu, 10 Jul 2014 13:30:43 +0400 Message-Id: <1404984647-8710-4-git-send-email-pshilovsky@samba.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1404984647-8710-1-git-send-email-pshilovsky@samba.org> References: <1404984647-8710-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=-7.4 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 8af078f..9f13b62 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