Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: olga.kornievskaia@gmail.com
Cc: linux-nfs@vger.kernel.org, trondmy@hammerspace.com,
	bfields@fieldses.org, chuck.lever@oracle.com
Subject: [PATCH v3 2/2] NFSv4.2: threshold for inter-server copy should be configurable.
Date: Fri,  9 Apr 2021 14:05:19 -0400	[thread overview]
Message-ID: <20210409180519.25405-3-dai.ngo@oracle.com> (raw)
In-Reply-To: <20210409180519.25405-1-dai.ngo@oracle.com>

Replacing threshold computed in __nfs4_copy_file_range with a
module configuration parameter, default to 16MB. This provides
the user the option to configure the threshold to suite each
specific configuration.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfs/nfs42.h    |  2 ++
 fs/nfs/nfs4file.c | 16 ++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
index 0fe5aac..6aecd05 100644
--- a/fs/nfs/nfs42.h
+++ b/fs/nfs/nfs42.h
@@ -60,5 +60,7 @@ static inline u32 nfs42_listxattr_xdrsize(u32 buflen)
 {
 	return ((buflen / (XATTR_USER_PREFIX_LEN + 2)) * 8) + 4;
 }
+
+extern unsigned int nfs4_ssc_inter_server_min_size;
 #endif /* CONFIG_NFS_V4_2 */
 #endif /* __LINUX_FS_NFS_NFS4_2_H */
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 441a2fa..57d6d13 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -20,6 +20,12 @@
 
 #ifdef CONFIG_NFS_V4_2
 #include "nfs42.h"
+
+unsigned int nfs4_ssc_inter_server_min_size = (1024*1024*16);
+EXPORT_SYMBOL_GPL(nfs4_ssc_inter_server_min_size);
+module_param(nfs4_ssc_inter_server_min_size, uint, 0644);
+MODULE_PARM_DESC(nfs4_ssc_inter_server_min_size,
+			"threshold to do inter-server copy");
 #endif
 
 #define NFSDBG_FACILITY		NFSDBG_FILE
@@ -158,13 +164,11 @@ static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
 		sync = true;
 retry:
 	if (!nfs42_files_from_same_server(file_in, file_out)) {
-		/* for inter copy, if copy size if smaller than 12 RPC
-		 * payloads, fallback to traditional copy. There are
-		 * 14 RPCs during an NFSv4.x mount between source/dest
-		 * servers.
+		/*
+		 * for inter copy, if copy size is too small
+		 * then fallback to generic copy.
 		 */
-		if (sync ||
-			count <= 14 * NFS_SERVER(file_inode(file_in))->rsize)
+		if (sync || count <= nfs4_ssc_inter_server_min_size)
 			return -EOPNOTSUPP;
 		cn_resp = kzalloc(sizeof(struct nfs42_copy_notify_res),
 				GFP_NOFS);
-- 
1.8.3.1


  parent reply	other threads:[~2021-04-09 18:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 18:05 [PATCH v3 0/2] NFSD: delay unmount source's export after inter-server copy completed Dai Ngo
2021-04-09 18:05 ` [PATCH v3 1/2] " Dai Ngo
2021-04-22  0:31   ` Olga Kornievskaia
2021-04-22 18:42     ` dai.ngo
2021-04-22 19:55       ` Olga Kornievskaia
2021-04-22 20:31         ` dai.ngo
2021-04-09 18:05 ` Dai Ngo [this message]
2021-04-11 16:46 ` [PATCH v3 0/2] " Chuck Lever III

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=20210409180519.25405-3-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=olga.kornievskaia@gmail.com \
    --cc=trondmy@hammerspace.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).