From patchwork Wed May 18 21:07:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9122391 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A47BBBF29F for ; Wed, 18 May 2016 21:08:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 965F9202AE for ; Wed, 18 May 2016 21:08:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BB0A20306 for ; Wed, 18 May 2016 21:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752082AbcERVII (ORCPT ); Wed, 18 May 2016 17:08:08 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33593 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbcERVIH (ORCPT ); Wed, 18 May 2016 17:08:07 -0400 Received: by mail-pa0-f49.google.com with SMTP id xk12so21408009pac.0 for ; Wed, 18 May 2016 14:08:06 -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=ym8Qb9F+jj9KpYI95Pmz5p01TQ2pg4Hba//K3LIqDXY=; b=z6xEtzHBSdmG920yDSLVca8CqM/0Zq/7lxbzM7fsJ7gHF4Dr7mBMqVTC5taIZNPZRG zM4qgxi6k65Vr80+8T+PtJXa1TSNtDk8N9GK4Ss00A8vOLXBTAIoEjBKPNR2OSHQXrdQ aYnwGZxN7bQMU6wGNWvntz4LVddpe8os6ckHT7ZgloJkdXDJ8d5X8r7u6Aaz3gzn+C05 w7BVhrbQ6P8httOgKbxYEBjhbIGEqX/zpF5oKvHrUbbuUq3n1CYKT7P3iUkhKEoUSLpx KBIXVmZJTM/ofgqQWI5BSG1hfoOt4+8wZeSu8hndvcIQEfUhNQz3Iot701dAFj/au4JL xuSw== 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=ym8Qb9F+jj9KpYI95Pmz5p01TQ2pg4Hba//K3LIqDXY=; b=GCaiKDu5mwQ5lJWVKbyPmYXAdnjft40D5WY8x9cwF+b1sTJ63Dpcx71LoffoVceFmB ZDPoetqbmRz7naZ/mr7AxGDUbYSxUjiH320NimDWw2GsgyHSh64qUYTNxXf0yVv+8azp 5uGh4rCCde3/VWNrOSGalobk/N4PjHgv6mN5UepqesfrM22PU6fgnuF8+27tenxDFg4c dPbMXLOWtjezxqSoF8piUGHiWNUu5FZc4xnM1171EoUTq4xaBOVJ0yTrbOsr58BRWtQf Yg5aFEgWA4HRemCF2fp/aXb6QSmB5WcLyxzI3CrXXD1RkzQLRo5XVof0+RP1bguZET0u sv8w== X-Gm-Message-State: AOPr4FXggUaiDIPq0B/gCJDMmm5LgIsJFZNGOKJ9aiRDy1vT1yBxbGiiiHvCAq9b1JvGopuR X-Received: by 10.66.222.3 with SMTP id qi3mr13994814pac.24.1463605686347; Wed, 18 May 2016 14:08:06 -0700 (PDT) Received: from jhereg.localdomain (63-157-6-18.dia.static.qwest.net. [63.157.6.18]) by smtp.gmail.com with ESMTPSA id lg17sm5134544pab.36.2016.05.18.14.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 May 2016 14:08:05 -0700 (PDT) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list , Anna Schumaker Subject: [PATCH 1/3] nfs/flexfiles: Helper function to detect FF_FLAGS_NO_READ_IO Date: Wed, 18 May 2016 14:07:54 -0700 Message-Id: <1463605676-82483-2-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1463605676-82483-1-git-send-email-loghyr@primarydata.com> References: <1463605676-82483-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-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 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 | 10 +++++++++- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h index 8dabf64..c66c6c1 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" @@ -155,6 +156,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); @@ -194,6 +201,7 @@ 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); struct file *ff_local_open_fh(struct pnfs_layout_segment *lseg, u32 ds_idx, struct nfs_client *clp, struct rpc_cred *cred, diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c index 1a603d4..b90c2bd 100644 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c @@ -623,6 +623,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 "