From patchwork Tue Apr 22 21:29:25 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: 4036161 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 78915C0DA2 for ; Tue, 22 Apr 2014 21:30:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BB8F201EC for ; Tue, 22 Apr 2014 21:30:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CEE920136 for ; Tue, 22 Apr 2014 21:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757865AbaDVV30 (ORCPT ); Tue, 22 Apr 2014 17:29:26 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:54882 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757973AbaDVV3Y (ORCPT ); Tue, 22 Apr 2014 17:29:24 -0400 Received: by mail-ig0-f178.google.com with SMTP id hn18so217399igb.11 for ; Tue, 22 Apr 2014 14:29:23 -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=ZaJ/Mu4cB/RBydc2B6RhJa9NmZIr6FXFJdjw153ql6g=; b=NDulVdvzezCHWGpP5JL1HyYjNH4cZUrfMtSpoI4fbAL+MSHcjIfL3kH+mDsh1hS2gs NH1M9Zq2JCuXCVDr0ImeH2G3/+aQLOwMvN7jXUP2JxT2vdpzHzMOXqHWXQOinQ5zhaGI Ff/KUzwsLBIcPCBOI13UuGaH7Yo6rnL+fVAM8sG1aKrysht+RXY32ozNFOVMmVUe2eVF SIREIZzGqamV2aDhTH4ooP58PGht/n1K0jahDP1UtXyzQcdzvSN16uUzAYYj74Yy40Y7 bfuQT/UtW7pykM4NtHCId0LG+ZFEHKEoqZymwIDJ687QkDUqjiZktqK58k21mCWeOhOq IL2g== X-Gm-Message-State: ALoCoQk+iauI2agppM0TnpTmNUwzx4B6eqAEb4zZ6fjtXOV0+SQW1qOI3vOV/8Oau8+J31OR8QGZ X-Received: by 10.50.28.84 with SMTP id z20mr518666igg.0.1398202163658; Tue, 22 Apr 2014 14:29:23 -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 j9sm31115582igu.10.2014.04.22.14.29.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 14:29:22 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 17/17] nfs: support page groups in nfs_read_completion Date: Tue, 22 Apr 2014 17:29:25 -0400 Message-Id: <1398202165-78897-18-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1398202165-78897-1-git-send-email-dros@primarydata.com> References: <1398202165-78897-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 c6b7dd0..e3613e2 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -182,7 +182,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; @@ -192,14 +191,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)) {