From patchwork Fri Sep 6 15:39:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 2854563 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 5AE3BC0AD3 for ; Fri, 6 Sep 2013 16:47:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB9342029B for ; Fri, 6 Sep 2013 16:47:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA2EB20121 for ; Fri, 6 Sep 2013 16:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756307Ab3IFPjT (ORCPT ); Fri, 6 Sep 2013 11:39:19 -0400 Received: from mx12.netapp.com ([216.240.18.77]:59641 "EHLO mx12.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753655Ab3IFPjS (ORCPT ); Fri, 6 Sep 2013 11:39:18 -0400 X-IronPort-AV: E=Sophos;i="4.90,855,1371106800"; d="scan'208,223";a="87228292" Received: from vmwexceht03-prd.hq.netapp.com ([10.106.76.241]) by mx12-out.netapp.com with ESMTP; 06 Sep 2013 08:39:17 -0700 Received: from SACEXCMBX04-PRD.hq.netapp.com ([169.254.6.213]) by vmwexceht03-prd.hq.netapp.com ([10.106.76.241]) with mapi id 14.03.0123.003; Fri, 6 Sep 2013 08:39:17 -0700 From: "Myklebust, Trond" To: Jeff Layton CC: Quentin Barnes , "linux-nfs@vger.kernel.org" Subject: Re: nfs-backed mmap file results in 1000s of WRITEs per second Thread-Topic: nfs-backed mmap file results in 1000s of WRITEs per second Thread-Index: AQHOqlP6IeJUk/D/3UCL1sI72/eClJm31EGAgAAj7oCAAA4RAIAAGn6AgAAFv4CAAApTAIAA/BcAgAAXj4CAAAD/gIAACbgA Date: Fri, 6 Sep 2013 15:39:16 +0000 Message-ID: <1378481956.3332.10.camel@leira.trondhjem.org> References: <20130905162110.GA17920@gmail.com> <20130905170303.GB17330@us.ibm.com> <20130905191139.GA20830@gmail.com> <1378411320.5450.27.camel@leira.trondhjem.org> <20130905213649.GA21944@gmail.com> <1378418243.5450.29.camel@leira.trondhjem.org> <20130905223420.GA23192@gmail.com> <20130906093636.6818e7b2@corrin.poochiereds.net> <1378479655.3332.3.camel@leira.trondhjem.org> <20130906110429.48000442@corrin.poochiereds.net> In-Reply-To: <20130906110429.48000442@corrin.poochiereds.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.106.53.51] MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable 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 On Fri, 2013-09-06 at 11:04 -0400, Jeff Layton wrote: > On Fri, 6 Sep 2013 15:00:56 +0000 > "Myklebust, Trond" wrote: > > > Also, do you need to do a similar fix to nfs_can_coalesce_requests? > > > > Yes. Good point! > > > > Cool. FWIW, here's the original bug that was opened against RHEL5: > > https://bugzilla.redhat.com/show_bug.cgi?id=736578 > > ...the reproducer that Max cooked up is not doing mmapped I/O so there > may be a difference there, but I haven't looked closely at why that is. Here is the patch... There should be no big differences between mmapped I/O and ordinary I/O now that we have page_mkwrite() to set up the request. The only difference that I can think of offhand is when you use locking: for mmap() writes, NFS can only guarantee data integrity if you lock the entire page. -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@netapp.com www.netapp.com From 4109bb7496640aa97a12904527ba8e3a19b7ce7a Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Fri, 6 Sep 2013 11:09:38 -0400 Subject: [PATCH] NFS: Don't check lock owner compatability unless file is locked (part 2) When coalescing requests into a single READ or WRITE RPC call, and there is no file locking involved, we don't have to refuse coalescing for requests where the lock owner information doesn't match. Reported-by: Jeff Layton Signed-off-by: Trond Myklebust --- fs/nfs/pagelist.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 29cfb7a..2ffebf2 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -328,6 +328,19 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, } EXPORT_SYMBOL_GPL(nfs_pageio_init); +static bool nfs_match_open_context(const struct nfs_open_context *ctx1, + const struct nfs_open_context *ctx2) +{ + return ctx1->cred == ctx2->cred && ctx1->state == ctx2->state; +} + +static bool nfs_match_lock_context(const struct nfs_lock_context *l1, + const struct nfs_lock_context *l2) +{ + return l1->lockowner.l_owner == l2->lockowner.l_owner + && l1->lockowner.l_pid == l2->lockowner.l_pid; +} + /** * nfs_can_coalesce_requests - test two requests for compatibility * @prev: pointer to nfs_page @@ -343,13 +356,10 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, struct nfs_page *req, struct nfs_pageio_descriptor *pgio) { - if (req->wb_context->cred != prev->wb_context->cred) - return false; - if (req->wb_lock_context->lockowner.l_owner != prev->wb_lock_context->lockowner.l_owner) - return false; - if (req->wb_lock_context->lockowner.l_pid != prev->wb_lock_context->lockowner.l_pid) + if (!nfs_match_open_context(req->wb_context, prev->wb_context)) return false; - if (req->wb_context->state != prev->wb_context->state) + if (req->wb_context->dentry->d_inode->i_flock != NULL && + !nfs_match_lock_context(req->wb_lock_context, prev->wb_lock_context)) return false; if (req->wb_pgbase != 0) return false; -- 1.8.3.1