From patchwork Sun Jun 19 22:33:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 895602 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5JMXrPw013295 for ; Sun, 19 Jun 2011 22:33:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754837Ab1FSWdw (ORCPT ); Sun, 19 Jun 2011 18:33:52 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:53981 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754729Ab1FSWdv (ORCPT ); Sun, 19 Jun 2011 18:33:51 -0400 Received: by pvg12 with SMTP id 12so277653pvg.19 for ; Sun, 19 Jun 2011 15:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=6QYyh92PdjGzfIQ23zIJDW1pIN06SZp95oUj/z4EpbQ=; b=Ye1AwvFETfxGkFFcRADzl42PRqXRYzaVSvAdt9hVU+X++ECTkRsqPTH/EBcsaqkZx/ 52OzTKG8MajVnt6KZb1UFud6lKplalIzSSNE5B3TvL2UV02i3wbiQO8au6OEqKSj9/7f shr8volpiqiVoyGnlWWLQzZcbsWf+yo2fENuc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=BVXD29d2oKj7fPz0aa3J/98CEJq/vs4upT7mAM03CpEILep3fQK2Hfl6R/DfVkdZzt gPKip5tWwH/cuglvHVWqiXthEQ/QdQNKq3YfSPQXPpTy15nGmjFaSnZ4U/371eYuQXJC 477CVIxLgl/TQDA7T1kh++LSSqVMQjwqZBVno= Received: by 10.142.136.15 with SMTP id j15mr685588wfd.372.1308522831173; Sun, 19 Jun 2011 15:33:51 -0700 (PDT) Received: from localhost.localdomain (209-45-135-130.dia.static.qwest.net [209.45.135.130]) by mx.google.com with ESMTPS id v6sm5581303wfe.14.2011.06.19.15.33.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Jun 2011 15:33:50 -0700 (PDT) From: Benny Halevy To: Trond Myklebust Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2] NFSv4.1: file layout must consider pg_bsize for coalescing Date: Sun, 19 Jun 2011 18:33:46 -0400 Message-Id: <1308522826-17268-1-git-send-email-benny@tonian.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1308520693-31114-1-git-send-email-benny@tonian.com> References: <1308520693-31114-1-git-send-email-benny@tonian.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sun, 19 Jun 2011 22:33:54 +0000 (UTC) Otherwise we end up overflowing the rpc buffer size on the receive end. Signed-off-by: Benny Halevy --- v2: Rebased onto nfs-2.6/bugfixes df18d12 fs/nfs/nfs4filelayout.c | 6 ++++-- fs/nfs/pagelist.c | 3 ++- include/linux/nfs_page.h | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 1aca430..f9d03ab 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c @@ -30,6 +30,7 @@ */ #include +#include #include "internal.h" #include "nfs4filelayout.h" @@ -665,8 +666,9 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, u64 p_stripe, r_stripe; u32 stripe_unit; - if (!pnfs_generic_pg_test(pgio, prev, req)) - return 0; + if (!pnfs_generic_pg_test(pgio, prev, req) || + !nfs_generic_pg_test(pgio, prev, req)) + return false; if (!pgio->pg_lseg) return 1; diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 7913961..0098557 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -204,7 +204,7 @@ nfs_wait_on_request(struct nfs_page *req) TASK_UNINTERRUPTIBLE); } -static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) +bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) { /* * FIXME: ideally we should be able to coalesce all requests @@ -218,6 +218,7 @@ static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_p return desc->pg_count + req->wb_bytes <= desc->pg_bsize; } +EXPORT_SYMBOL_GPL(nfs_generic_pg_test); /** * nfs_pageio_init - initialise a page io descriptor diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index 3a34e80..25311b3 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h @@ -92,6 +92,9 @@ extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, struct nfs_page *); extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); +extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, + struct nfs_page *prev, + struct nfs_page *req); extern int nfs_wait_on_request(struct nfs_page *); extern void nfs_unlock_request(struct nfs_page *req); extern int nfs_set_page_tag_locked(struct nfs_page *req);