From patchwork Wed May 25 14:31:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9135551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8D39C607D5 for ; Wed, 25 May 2016 14:31:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F9C62822B for ; Wed, 25 May 2016 14:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 747FB282BB; Wed, 25 May 2016 14:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2275C2822B for ; Wed, 25 May 2016 14:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753960AbcEYObr (ORCPT ); Wed, 25 May 2016 10:31:47 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:34146 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753811AbcEYObq (ORCPT ); Wed, 25 May 2016 10:31:46 -0400 Received: by mail-pa0-f49.google.com with SMTP id qo8so18357815pab.1 for ; Wed, 25 May 2016 07:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UMNXlkBcwM4lbjHts6GMcelKi58iDJkSN2dwAQdo+2k=; b=tMOXNa1Y9/UJlxKP3bEDb/WAIyyq3f1p+gboId8mGD0cNaFWWCMEJz9uqVnyZpZCOr 6QPdOFALbXoA9vevPblKLJ7fMdpYInBQv6Ycnohi3scTo/yL7yawyL3CdigQI5yO+aiI aYBVq4QWON/BjnRFDpxXYXxqF/+7fcK88Q2xmuyBsp1G1jYA0hUuGJRHk1jCTAVMVJwW RwyVNIhNIn/0DMHwQdanRn1CzjvSxm//OBv5OPMKjtx5qQqw1X+yMWs59aD7EFtN/BaI R5uSBVt6ow3RuaKO+A9pHOcKzUkdfvSO+a0cZ6TEHrhjniFgiFaaItCtS3AtYjqtZXg5 YOdw== 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=UMNXlkBcwM4lbjHts6GMcelKi58iDJkSN2dwAQdo+2k=; b=XAMYPmV74J/jgRt9VLQ/yxOQATGnRT9RkDg8zvu2iE0Ror6D9WjNgP9vRHZnY0wr6s QUu0SugaajyNrexuBUasmoWBT9cHi+6cq5EU2vU9B5XsiujsbN4HHJeYeZjTYQJwaiEB ArmtrEYdil8zXMXSgoU/EdY8BOhrtCFltopFvsgtb0TJzMrdQv82jySGqySgme6eTzqy e37K16jVRs7NUNYWMusJ2y5yjO0Wexw3vFDnzjPy0amgC9ktPLrlyWTV6GHEM3z0XgHc TKQ7ZYryz8kEc8E4QrIvn78B8P4BBXtV1uuLYxj82GIyMb28rmiDm6akVcw1ZaJu2B0T vvmA== X-Gm-Message-State: ALyK8tKJKA13JjDO46QEp3d9h1u//g1Tml154q1U9ehoQjMx7rooif21ojn4D4HmzPHLaqsD X-Received: by 10.66.78.73 with SMTP id z9mr6247692paw.4.1464186705624; Wed, 25 May 2016 07:31:45 -0700 (PDT) Received: from jhereg.localdomain (c-50-131-226-197.hsd1.ca.comcast.net. [50.131.226.197]) by smtp.gmail.com with ESMTPSA id 17sm26556474pfj.96.2016.05.25.07.31.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 07:31:45 -0700 (PDT) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list , Anna Schumaker Subject: [V2 2/3] nfs/flexfiles: Use the layout segment for reading unless it a IOMODE_RW and reading is disabled Date: Wed, 25 May 2016 07:31:13 -0700 Message-Id: <1464186674-104401-3-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1464186674-104401-1-git-send-email-loghyr@primarydata.com> References: <1464186674-104401-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tom Haynes --- fs/nfs/flexfilelayout/flexfilelayout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 40bccb2..a7aeb74 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -830,7 +830,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, int ds_idx; /* Use full layout for now */ - if (!pgio->pg_lseg) { + if (!pgio->pg_lseg || ff_layout_avoid_read_on_rw(pgio->pg_lseg)) { + pnfs_put_lseg(pgio->pg_lseg); pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, req->wb_context, 0, @@ -840,9 +841,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, if (IS_ERR(pgio->pg_lseg)) { pgio->pg_error = PTR_ERR(pgio->pg_lseg); pgio->pg_lseg = NULL; - return; } } + /* If no lseg, fall back to read through mds */ if (pgio->pg_lseg == NULL) goto out_mds;