All of lore.kernel.org
 help / color / mirror / Atom feed
From: schumaker.anna@gmail.com
To: Trond.Myklebust@hammerspace.com, linux-nfs@vger.kernel.org
Cc: Anna.Schumaker@Netapp.com
Subject: [PATCH 6/6] NFS: Add a mount option for READ_PLUS
Date: Fri, 22 Feb 2019 16:59:18 -0500	[thread overview]
Message-ID: <20190222215918.20647-7-Anna.Schumaker@Netapp.com> (raw)
In-Reply-To: <20190222215918.20647-1-Anna.Schumaker@Netapp.com>

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

There are some workloads where READ_PLUS might end up hurting
performance, so let's be nice to users and provide a way to disable this
operation similar to how READDIR_PLUS can be disabled.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs4client.c       |  3 +++
 fs/nfs/super.c            | 21 +++++++++++++++++++++
 include/linux/nfs4.h      |  4 ++--
 include/linux/nfs_fs_sb.h |  1 +
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 2548405da1f7..2bb603d1a80f 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -998,6 +998,9 @@ static int nfs4_server_common_setup(struct nfs_server *server,
 	server->caps |= server->nfs_client->cl_mvops->init_caps;
 	if (server->flags & NFS_MOUNT_NORDIRPLUS)
 			server->caps &= ~NFS_CAP_READDIRPLUS;
+	if (server->options & NFS_OPTION_NO_READ_PLUS)
+		server->caps &= ~NFS_CAP_READ_PLUS;
+
 	/*
 	 * Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower
 	 * authentication.
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 0570391eaa16..5b8701fca5b9 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -90,6 +90,7 @@ enum {
 	Opt_resvport, Opt_noresvport,
 	Opt_fscache, Opt_nofscache,
 	Opt_migration, Opt_nomigration,
+	Opt_readplus, Opt_noreadplus,
 
 	/* Mount options that take integer arguments */
 	Opt_port,
@@ -151,6 +152,8 @@ static const match_table_t nfs_mount_option_tokens = {
 	{ Opt_nofscache, "nofsc" },
 	{ Opt_migration, "migration" },
 	{ Opt_nomigration, "nomigration" },
+	{ Opt_readplus, "readplus" },
+	{ Opt_noreadplus, "noreadplus" },
 
 	{ Opt_port, "port=%s" },
 	{ Opt_rsize, "rsize=%s" },
@@ -690,6 +693,11 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
 	if (nfss->options & NFS_OPTION_MIGRATION)
 		seq_printf(m, ",migration");
 
+	if (nfss->options & NFS_OPTION_NO_READ_PLUS)
+		seq_printf(m,",noreadplus");
+	else
+		seq_printf(m,",readplus");
+
 	if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
 		if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
 			seq_printf(m, ",lookupcache=none");
@@ -1324,6 +1332,12 @@ static int nfs_parse_mount_options(char *raw,
 		case Opt_nomigration:
 			mnt->options &= ~NFS_OPTION_MIGRATION;
 			break;
+		case Opt_readplus:
+			mnt->options &= ~NFS_OPTION_NO_READ_PLUS;
+			break;
+		case Opt_noreadplus:
+			mnt->options |= NFS_OPTION_NO_READ_PLUS;
+			break;
 
 		/*
 		 * options that take numeric values
@@ -1626,6 +1640,9 @@ static int nfs_parse_mount_options(char *raw,
 	if (mnt->options & NFS_OPTION_MIGRATION &&
 	    (mnt->version != 4 || mnt->minorversion != 0))
 		goto out_migration_misuse;
+	if (mnt->options & NFS_OPTION_NO_READ_PLUS &&
+	    (mnt->version != 4 || mnt->minorversion < 2))
+		goto out_noreadplus_misuse;
 
 	/*
 	 * verify that any proto=/mountproto= options match the address
@@ -1668,6 +1685,10 @@ static int nfs_parse_mount_options(char *raw,
 	printk(KERN_INFO
 		"NFS: 'migration' not supported for this NFS version\n");
 	return 0;
+out_noreadplus_misuse:
+	printk(KERN_INFO
+		"NFS: 'noreadplus' not supported for this NFS version\n");
+	return 0;
 out_nomem:
 	printk(KERN_INFO "NFS: not enough memory to parse option\n");
 	return 0;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index db465ad6659b..2fd3cf2061c2 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -535,10 +535,10 @@ enum {
 	NFSPROC4_CLNT_LAYOUTSTATS,
 	NFSPROC4_CLNT_CLONE,
 	NFSPROC4_CLNT_COPY,
-	NFSPROC4_CLNT_OFFLOAD_CANCEL,
-	NFSPROC4_CLNT_READ_PLUS,
 
 	NFSPROC4_CLNT_LOOKUPP,
+	NFSPROC4_CLNT_OFFLOAD_CANCEL,
+	NFSPROC4_CLNT_READ_PLUS,
 };
 
 /* nfs41 types */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index e431c2a7affd..c95be09b84f1 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -157,6 +157,7 @@ struct nfs_server {
 	unsigned int		clone_blksize;	/* granularity of a CLONE operation */
 #define NFS_OPTION_FSCACHE	0x00000001	/* - local caching enabled */
 #define NFS_OPTION_MIGRATION	0x00000002	/* - NFSv4 migration enabled */
+#define NFS_OPTION_NO_READ_PLUS	0x00000004	/* - NFSv4.2 READ_PLUS enabled */
 
 	struct nfs_fsid		fsid;
 	__u64			maxfilesize;	/* maximum file size */
-- 
2.20.1


      parent reply	other threads:[~2019-02-22 21:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 21:59 [PATCH 0/6] NFS: Add support for the v4.2 READ_PLUS operation schumaker.anna
2019-02-22 21:59 ` [PATCH 1/6] SUNRPC: Split out a function for setting current page schumaker.anna
2019-02-22 21:59 ` [PATCH 2/6] SUNRPC: Add the ability to expand holes in data pages schumaker.anna
2019-02-22 21:59 ` [PATCH 3/6] SUNRPC: Add the ability to shift data to a specific offset schumaker.anna
2019-02-22 21:59 ` [PATCH 4/6] NFS: Add basic READ_PLUS support schumaker.anna
2019-02-22 21:59 ` [PATCH 5/6] NFS: Add support for decoding multiple segments schumaker.anna
2019-02-22 21:59 ` schumaker.anna [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190222215918.20647-7-Anna.Schumaker@Netapp.com \
    --to=schumaker.anna@gmail.com \
    --cc=Anna.Schumaker@Netapp.com \
    --cc=Trond.Myklebust@hammerspace.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.