From patchwork Wed May 25 14:31:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9135549 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 CED10607D5 for ; Wed, 25 May 2016 14:31:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0FD02822B for ; Wed, 25 May 2016 14:31:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5B5F282BB; Wed, 25 May 2016 14:31:47 +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 289832822B for ; Wed, 25 May 2016 14:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753551AbcEYObq (ORCPT ); Wed, 25 May 2016 10:31:46 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:32837 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753811AbcEYObp (ORCPT ); Wed, 25 May 2016 10:31:45 -0400 Received: by mail-pf0-f172.google.com with SMTP id b124so19147970pfb.0 for ; Wed, 25 May 2016 07:31:45 -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=7bnyeEybyjA2lvKmwafbGY8bSifOnIxmxPbkITy5A5w=; b=l09cjx+SMTg3yg6WCVgRKjZs55WqpzKtdMbfuJoFWCQQTuxxKxe4RC78KdKedOAv2I rTXDUyPq85PgGOtwM7u8806oiA/EDl2omXO6Vswx9Bl8sJjQxohpKQFkDBRXUCv+dXbv ozMw70BBSNvpnnzWfqjyyowK+f4kPJR+vMW/8QL+d4D4FVM/ciyQ2hJmmovnHGW+xblP YTOHqND84E/EtRuD0kmsYCIdMLCEZsU0doutHR+nLWH58QHRXpIweaMYeEJnIzVtKiBH OkbNkyWb8z29/TAt5q+boHJzpxqrxsXvrjIi0KaVzMgqVeXJj2TBWy5SH2Lk7YwSdZkV /HSA== 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=7bnyeEybyjA2lvKmwafbGY8bSifOnIxmxPbkITy5A5w=; b=KWzGP6GgsXxormKa66JKmyaB/j/7Z20/eFZPCeXW4eQfoRDdd5lJRX+Djkm08hRDlw VzA23dZx7mAfyb4c3xLjFCf11qxrQVEWQbnIg4V43AG1TEzj0rkQKjWi95YTEBEjPU9S 08G2AclVE2aNfAMYtBSZMPb4OIgWHA1jvQoTpSTHSWbFkj8MvXuDOjS9mjEmSrtTVGEk 19ECzETJEQ9eKDSCwR0YWLmOpC7GUJTYZDgi9u2oZVydMCUxiE6FDS2QOZ8kzdS1ExA1 APA8dw6vnNI1aubdkPebw3C/uC/YPtSYyQwYAPr3nfHPkoDBY9+rFHJEqEIDmp8AkYoX /FXg== X-Gm-Message-State: ALyK8tJFJBdfpHf3g5g1ceS1ME+0DV8VgYZnYJJFu6ijE2Y86ccRmpbDer9IG/xb9cEer7sr X-Received: by 10.98.104.133 with SMTP id d127mr6296323pfc.112.1464186704415; Wed, 25 May 2016 07:31:44 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 07:31:43 -0700 (PDT) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list , Anna Schumaker Subject: [V2 1/3] nfs/flexfiles: Helper function to detect FF_FLAGS_NO_READ_IO Date: Wed, 25 May 2016 07:31:12 -0700 Message-Id: <1464186674-104401-2-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 The mds can inform the client not to use the IOMODE_RW layout segment for doing READs. I.e., it is basically a IOMODE_WRITE layout segment. It would do this to not interfere with the WRITEs. Signed-off-by: Tom Haynes --- fs/nfs/flexfilelayout/flexfilelayout.h | 11 ++++++++++- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h index b540581..1bcdb15 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.h +++ b/fs/nfs/flexfilelayout/flexfilelayout.h @@ -10,7 +10,8 @@ #define FS_NFS_NFS4FLEXFILELAYOUT_H #define FF_FLAGS_NO_LAYOUTCOMMIT 1 -#define FF_FLAGS_NO_IO_THRU_MDS 2 +#define FF_FLAGS_NO_IO_THRU_MDS 2 +#define FF_FLAGS_NO_READ_IO 4 #include "../pnfs.h" @@ -153,6 +154,12 @@ ff_layout_no_fallback_to_mds(struct pnfs_layout_segment *lseg) } static inline bool +ff_layout_no_read_on_rw(struct pnfs_layout_segment *lseg) +{ + return FF_LAYOUT_LSEG(lseg)->flags & FF_FLAGS_NO_READ_IO; +} + +static inline bool ff_layout_test_devid_unavailable(struct nfs4_deviceid_node *node) { return nfs4_test_deviceid_unavailable(node); @@ -192,4 +199,6 @@ struct rpc_cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg, u32 ds_idx, struct rpc_cred *mdscred); bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg); bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg); +bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg); + #endif /* FS_NFS_NFS4FLEXFILELAYOUT_H */ diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c index 35d84d0..0aa36be 100644 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c @@ -557,6 +557,12 @@ bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg) ff_layout_has_available_ds(lseg); } +bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg) +{ + return lseg->pls_range.iomode == IOMODE_RW && + ff_layout_no_read_on_rw(lseg); +} + module_param(dataserver_retrans, uint, 0644); MODULE_PARM_DESC(dataserver_retrans, "The number of times the NFSv4.1 client " "retries a request before it attempts further "