From patchwork Thu Apr 24 18:15:15 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: 4053201 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 97589C0ACC for ; Thu, 24 Apr 2014 18:15:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5F1A2034E for ; Thu, 24 Apr 2014 18:15:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9AFFD2034A for ; Thu, 24 Apr 2014 18:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932156AbaDXSPo (ORCPT ); Thu, 24 Apr 2014 14:15:44 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:33921 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084AbaDXSPn (ORCPT ); Thu, 24 Apr 2014 14:15:43 -0400 Received: by mail-ig0-f181.google.com with SMTP id h18so1242038igc.2 for ; Thu, 24 Apr 2014 11:15:43 -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=GpYdaDdjbKSHq5poOT8MDAAciqjpr2hRy1ObEYrziQk=; b=QJBq3Z+A4Xybi47NWrAvSCZolQMunyy1IuQDgXebp8ysZ/66ZSt3xY3m3naC00j6uI gs9m6lbeR64DU3W/pFYM7IhLLuJU/ap5me6CmQboes4aEjHsdlT1wgBEfwcjdFQzOnxx 2jykj5awiZWWDAyckLueXt6S1IoVLfcctRFdqmESwtghJ0Psq48N+LV1LWYtqXR8ML8k HASKiKr8VuRVQtfYCWkJX0c/ZhRyOR59Y72FqqnCYQnK0biIuRJtfpw44SDsOZ63StI9 2pSYEuhy1fRXUPrgvYgUbgRaPqXpeEQt3UdvxdehMpF72ngqA7zKdM+CBc/jEtLSiMEs vL7g== X-Gm-Message-State: ALoCoQkpxTdKWBteF/vlI94vCCP65dt9J5THzeVc3YM98xMFutlbEeifoYXrcgbGnD5HjrKQqCmk X-Received: by 10.50.30.170 with SMTP id t10mr236772igh.7.1398363342990; Thu, 24 Apr 2014 11:15:42 -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 lp4sm789824igb.12.2014.04.24.11.15.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Apr 2014 11:15:42 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 05/18 v2] nfs: call nfs_can_coalesce_requests for every req Date: Thu, 24 Apr 2014 14:15:15 -0400 Message-Id: <1398363328-7100-6-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1398363328-7100-1-git-send-email-dros@primarydata.com> References: <1398363328-7100-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 Call nfs_can_coalesce_requests for every request, even the first one. This is needed for future patches to give pg_test a way to inform add_request to reduce the size of the request. Now @prev can be null in nfs_can_coalesce_requests and pg_test functions. Signed-off-by: Weston Andros Adamson --- fs/nfs/nfs4filelayout.c | 3 +++ fs/nfs/pagelist.c | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index ba9a9aa..9319427 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c @@ -929,6 +929,9 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, !nfs_generic_pg_test(pgio, prev, req)) return 0; + if (!prev) + return req->wb_bytes; + p_stripe = (u64)req_offset(prev); r_stripe = (u64)req_offset(req); stripe_unit = FILELAYOUT_LSEG(pgio->pg_lseg)->stripe_unit; diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 4cd7a2a..b120728 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -289,6 +289,8 @@ nfs_wait_on_request(struct nfs_page *req) size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req) { + if (!prev) + return req->wb_bytes; /* * FIXME: ideally we should be able to coalesce all requests * that are not block boundary aligned, but currently this @@ -370,17 +372,20 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, { size_t size; - if (!nfs_match_open_context(req->wb_context, prev->wb_context)) - return false; - 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; - if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) - return false; - if (req_offset(req) != req_offset(prev) + prev->wb_bytes) - return false; + if (prev) { + if (!nfs_match_open_context(req->wb_context, prev->wb_context)) + return false; + 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; + if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE) + return false; + if (req_offset(req) != req_offset(prev) + prev->wb_bytes) + return false; + } size = pgio->pg_ops->pg_test(pgio, prev, req); WARN_ON_ONCE(size && size != req->wb_bytes); return size > 0; @@ -397,17 +402,16 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc, struct nfs_page *req) { + struct nfs_page *prev = NULL; if (desc->pg_count != 0) { - struct nfs_page *prev; - prev = nfs_list_entry(desc->pg_list.prev); - if (!nfs_can_coalesce_requests(prev, req, desc)) - return 0; } else { if (desc->pg_ops->pg_init) desc->pg_ops->pg_init(desc, req); desc->pg_base = req->wb_pgbase; } + if (!nfs_can_coalesce_requests(prev, req, desc)) + return 0; nfs_list_remove_request(req); nfs_list_add_request(req, &desc->pg_list); desc->pg_count += req->wb_bytes;