From patchwork Thu May 15 15:56:55 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: 4183511 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 5F0D2C0ACC for ; Thu, 15 May 2014 15:57:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EF98201C8 for ; Thu, 15 May 2014 15:57:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1C2820379 for ; Thu, 15 May 2014 15:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755192AbaEOP5f (ORCPT ); Thu, 15 May 2014 11:57:35 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:50965 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755202AbaEOP5e (ORCPT ); Thu, 15 May 2014 11:57:34 -0400 Received: by mail-ie0-f181.google.com with SMTP id rl12so1214749iec.40 for ; Thu, 15 May 2014 08:57:34 -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=6/aN8VF8Tk0N7iq20uFqu5fbiEEElM69KnHHFY3Injk=; b=XIOZJ/nUk58rlWYfeCtmaEcducexZ1FBVd4F8xN/q9X0xBcbfFDIUieb/ROuup+REq O7f4xR1BJXZJTcPmsQdYkT5fmJeFo/GZkQHtGJ0Umz+OulibsdryeKY5PwOLHckYCd7F suTumLh0GsEKZORKQNegx/t/gH2ZhFZzT6IxSbo7Y75lwQqzzLUwlNxN58aPF9hiXy/F djPyedwkUOytAddbDBSlics+G3v3ku2r6jccHJcuE2ZrdfCiwCa/tGTYT0SIJPRGn6e/ 9i+lFHzpv+tQnQD7sps3IGHJz5/30yU4dY1pM1/L+eJE3LUNguSjQiyvy05ZnE5cRiKp pWpg== X-Gm-Message-State: ALoCoQmDgwNcqsp9YZY9bvR6+LZRSLH8TJpebYDRJ+EQmEPu26GDFApaHWhps3ikTPCtebEqvk3T X-Received: by 10.43.140.144 with SMTP id ja16mr10853008icc.46.1400169454019; Thu, 15 May 2014 08:57:34 -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.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 15 May 2014 08:57:33 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH v3 16/18] pnfs: allow non page aligned pnfs layout segments Date: Thu, 15 May 2014 11:56:55 -0400 Message-Id: <1400169417-28245-17-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 Remove alignment checks that would revert to MDS and change pg_test to return the max ammount left in the segment (or other pg_test call) up to size of passed request, or 0 if no space is left. Signed-off-by: Weston Andros Adamson --- fs/nfs/pnfs.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6ef108b..ce46a41 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1388,11 +1388,6 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r WARN_ON_ONCE(pgio->pg_lseg != NULL); - if (req->wb_offset != req->wb_pgbase) { - nfs_pageio_reset_read_mds(pgio); - return; - } - if (pgio->pg_dreq == NULL) rd_size = i_size_read(pgio->pg_inode) - req_offset(req); else @@ -1417,11 +1412,6 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, { WARN_ON_ONCE(pgio->pg_lseg != NULL); - if (req->wb_offset != req->wb_pgbase) { - nfs_pageio_reset_write_mds(pgio); - return; - } - pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, req->wb_context, req_offset(req), @@ -1443,9 +1433,9 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, struct nfs_page *req) { unsigned int size; + u64 end; size = nfs_generic_pg_test(pgio, prev, req); - if (!size) return 0; @@ -1463,11 +1453,16 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, * first byte that lies outside the pnfs_layout_range. FIXME? * */ - if (req_offset(req) >= end_offset(pgio->pg_lseg->pls_range.offset, - pgio->pg_lseg->pls_range.length)) - return 0; + if (pgio->pg_lseg) { + end = end_offset(pgio->pg_lseg->pls_range.offset, + pgio->pg_lseg->pls_range.length); + WARN_ON_ONCE(req_offset(req) > end); + if (req_offset(req) >= end) + return 0; + size = min((unsigned int)(end - req_offset(req)), size); + } - return min(size, req->wb_bytes); + return size; } EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);