From patchwork Thu May 15 15:56:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 4183531 Return-Path: X-Original-To: patchwork-linux-nfs@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 A6A40C0ACC for ; Thu, 15 May 2014 15:57:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D466720379 for ; Thu, 15 May 2014 15:57:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E8242037E for ; Thu, 15 May 2014 15:57:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755202AbaEOP5i (ORCPT ); Thu, 15 May 2014 11:57:38 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:39918 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755213AbaEOP5h (ORCPT ); Thu, 15 May 2014 11:57:37 -0400 Received: by mail-ie0-f175.google.com with SMTP id y20so1185771ier.6 for ; Thu, 15 May 2014 08:57:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PE19V+5HqsBfJm3nGCSBoZKqfS1K1fGFb00AJWn1TkA=; b=lt+KfP2qnCKHuTbAV2fB+XsnDq2lnvCreA0CQQzSV0rlRk2Vdr+E+tAOZkZzg9Qa5L 9DUFScWJRTw1ldINf8QuGnkKNxLh47YYApkqMqP2zneysi/U+f6QOUVaRvpAoNJpoebQ ZPwA1xtOFd52zX43xsqqRd8H70lXeQTc5daqnzboW8hcJ9ZZ9tF51Mp3Lp5MrC/ULgJI bdo76xyMh8io+Qt6eOiCEpEMca4Wz2V/IeIEjfjvhdRWGUFjyEgpp/URGDd/P9Pb8raa 5WH0/diw6bEdzOL8CfFljGD/XouPM1hzhTtTOdFIhVEqnYme6jkuGbmem4vHNiWrLsMQ oreQ== X-Gm-Message-State: ALoCoQnGEqSC8YoJRYOo9QvGQ9Lb6Dj0RcGbeU/2yNSEzxFslrSNheARVQtn7C2pVgHPMyoVV6/c X-Received: by 10.42.157.74 with SMTP id c10mr3274327icx.74.1400169457542; Thu, 15 May 2014 08:57:37 -0700 (PDT) Received: from gavrio-wifi.robotsandstuff.fake (c-98-209-19-144.hsd1.mi.comcast.net. [98.209.19.144]) by mx.google.com with ESMTPSA id jf5sm13964856igb.19.2014.05.15.08.57.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 May 2014 08:57:36 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH v3 18/18] nfs: support page groups in nfs_read_completion Date: Thu, 15 May 2014 11:56:57 -0400 Message-Id: <1400169417-28245-19-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1400169417-28245-1-git-send-email-dros@primarydata.com> References: <1400169417-28245-1-git-send-email-dros@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 nfs_read_completion relied on the fact that there was a 1:1 mapping of page to nfs_request, but this has now changed. Regions not covered by a request have already been zeroed elsewhere. Signed-off-by: Weston Andros Adamson --- fs/nfs/read.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 53d5b83..e818a47 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -130,7 +130,6 @@ static void nfs_page_group_set_uptodate(struct nfs_page *req) SetPageUptodate(req->wb_page); } -/* Note io was page aligned */ static void nfs_read_completion(struct nfs_pgio_header *hdr) { unsigned long bytes = 0; @@ -140,14 +139,25 @@ static void nfs_read_completion(struct nfs_pgio_header *hdr) while (!list_empty(&hdr->pages)) { struct nfs_page *req = nfs_list_entry(hdr->pages.next); struct page *page = req->wb_page; + unsigned long start = req->wb_pgbase; + unsigned long end = req->wb_pgbase + req->wb_bytes; if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) { - if (bytes > hdr->good_bytes) - zero_user(page, 0, PAGE_SIZE); - else if (hdr->good_bytes - bytes < PAGE_SIZE) - zero_user_segment(page, - hdr->good_bytes & ~PAGE_MASK, - PAGE_SIZE); + /* note: regions of the page not covered by a + * request are zeroed in nfs_readpage_async / + * readpage_async_filler */ + if (bytes > hdr->good_bytes) { + /* nothing in this request was good, so zero + * the full extent of the request */ + zero_user_segment(page, start, end); + + } else if (hdr->good_bytes - bytes < req->wb_bytes) { + /* part of this request has good bytes, but + * not all. zero the bad bytes */ + start += hdr->good_bytes - bytes; + WARN_ON(start < req->wb_pgbase); + zero_user_segment(page, start, end); + } } bytes += req->wb_bytes; if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {