[PATCH] NFS: Add acreg{min,max} and acdir{min,max} in milliseconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds 4 new NFS mount options(acdirminms, acdirmaxms, acregminms,acregmaxms) converting already existing one into a millisecond resolutioninstead of seconds.
Also, modifies the mountstats output to milliseconds instead of seconds.
Signed-off-by: Amit Gud <agud@xxxxxxxxxx>
AG--May the source with you.http://www.cis.ksu.edu/~gud
Index: linux-2.6/fs/nfs/client.c===================================================================--- linux-2.6.orig/fs/nfs/client.c+++ linux-2.6/fs/nfs/client.c@@ -772,10 +772,10 @@ static int nfs_init_server(struct nfs_se 	if (data->wsize) 		server->wsize = nfs_block_size(data->wsize, NULL); -	server->acregmin = data->acregmin * HZ;-	server->acregmax = data->acregmax * HZ;-	server->acdirmin = data->acdirmin * HZ;-	server->acdirmax = data->acdirmax * HZ;+	server->acregmin = (data->acregminms * HZ) / 1000;+	server->acregmax = (data->acregmaxms * HZ) / 1000;+	server->acdirmin = (data->acdirminms * HZ) / 1000;+	server->acdirmax = (data->acdirmaxms * HZ) / 1000;  	/* Start lockd here, before we might error out */ 	error = nfs_start_lockd(server);@@ -1173,10 +1173,10 @@ static int nfs4_init_server(struct nfs_s 	if (data->wsize) 		server->wsize = nfs_block_size(data->wsize, NULL); -	server->acregmin = data->acregmin * HZ;-	server->acregmax = data->acregmax * HZ;-	server->acdirmin = data->acdirmin * HZ;-	server->acdirmax = data->acdirmax * HZ;+	server->acregmin = (data->acregminms * HZ) / 1000;+	server->acregmax = (data->acregmaxms * HZ) / 1000;+	server->acdirmin = (data->acdirminms * HZ) / 1000;+	server->acdirmax = (data->acdirmaxms * HZ) / 1000;  	server->port = data->nfs_server.port; Index: linux-2.6/fs/nfs/internal.h===================================================================--- linux-2.6.orig/fs/nfs/internal.h+++ linux-2.6/fs/nfs/internal.h@@ -36,8 +36,8 @@ struct nfs_parsed_mount_data { 	int			flags; 	int			rsize, wsize; 	int			timeo, retrans;-	int			acregmin, acregmax,-				acdirmin, acdirmax;+	int			acregminms, acregmaxms,+				acdirminms, acdirmaxms; 	int			namlen; 	unsigned int		options; 	unsigned int		bsize;Index: linux-2.6/fs/nfs/nfsroot.c===================================================================--- linux-2.6.orig/fs/nfs/nfsroot.c+++ linux-2.6/fs/nfs/nfsroot.c@@ -297,10 +297,10 @@ static int __init root_nfs_name(char *na 	nfs_data.flags    = NFS_MOUNT_NONLM;	/* No lockd in nfs root yet */ 	nfs_data.rsize    = NFS_DEF_FILE_IO_SIZE; 	nfs_data.wsize    = NFS_DEF_FILE_IO_SIZE;-	nfs_data.acregmin = NFS_DEF_ACREGMIN;-	nfs_data.acregmax = NFS_DEF_ACREGMAX;-	nfs_data.acdirmin = NFS_DEF_ACDIRMIN;-	nfs_data.acdirmax = NFS_DEF_ACDIRMAX;+	nfs_data.acregmin = NFS_DEF_ACREGMIN_MS / 1000;+	nfs_data.acregmax = NFS_DEF_ACREGMAX_MS / 1000;+	nfs_data.acdirmin = NFS_DEF_ACDIRMIN_MS / 1000;+	nfs_data.acdirmax = NFS_DEF_ACDIRMAX_MS / 1000; 	strcpy(buf, NFS_ROOT);  	/* Process options received from the remote server */Index: linux-2.6/fs/nfs/super.c===================================================================--- linux-2.6.orig/fs/nfs/super.c+++ linux-2.6/fs/nfs/super.c@@ -85,6 +85,8 @@ enum { 	Opt_timeo, Opt_retrans, 	Opt_acregmin, Opt_acregmax, 	Opt_acdirmin, Opt_acdirmax,+	Opt_acregminms, Opt_acregmaxms,+	Opt_acdirminms, Opt_acdirmaxms, 	Opt_actimeo, 	Opt_namelen, 	Opt_mountport,@@ -149,6 +151,10 @@ static const match_table_t nfs_mount_opt 	{ Opt_acregmax, "acregmax=%u" }, 	{ Opt_acdirmin, "acdirmin=%u" }, 	{ Opt_acdirmax, "acdirmax=%u" },+	{ Opt_acregminms, "acregminms=%u" },+	{ Opt_acregmaxms, "acregmaxms=%u" },+	{ Opt_acdirminms, "acdirminms=%u" },+	{ Opt_acdirmaxms, "acdirmaxms=%u" }, 	{ Opt_actimeo, "actimeo=%u" }, 	{ Opt_namelen, "namlen=%u" }, 	{ Opt_mountport, "mountport=%u" },@@ -535,14 +541,14 @@ static void nfs_show_mount_options(struc 	if (nfss->bsize != 0) 		seq_printf(m, ",bsize=%u", nfss->bsize); 	seq_printf(m, ",namlen=%u", nfss->namelen);-	if (nfss->acregmin != NFS_DEF_ACREGMIN*HZ || showdefaults)-		seq_printf(m, ",acregmin=%u", nfss->acregmin/HZ);-	if (nfss->acregmax != NFS_DEF_ACREGMAX*HZ || showdefaults)-		seq_printf(m, ",acregmax=%u", nfss->acregmax/HZ);-	if (nfss->acdirmin != NFS_DEF_ACDIRMIN*HZ || showdefaults)-		seq_printf(m, ",acdirmin=%u", nfss->acdirmin/HZ);-	if (nfss->acdirmax != NFS_DEF_ACDIRMAX*HZ || showdefaults)-		seq_printf(m, ",acdirmax=%u", nfss->acdirmax/HZ);+	if (nfss->acregmin != (NFS_DEF_ACREGMIN_MS*HZ)/1000 || showdefaults)+		seq_printf(m, ",acregminms=%u", (nfss->acregmin*1000)/HZ);+	if (nfss->acregmax != (NFS_DEF_ACREGMAX_MS*HZ)/1000 || showdefaults)+		seq_printf(m, ",acregmaxms=%u", (nfss->acregmax*1000)/HZ);+	if (nfss->acdirmin != (NFS_DEF_ACDIRMIN_MS*HZ)/1000 || showdefaults)+		seq_printf(m, ",acdirminms=%u", (nfss->acdirmin*1000)/HZ);+	if (nfss->acdirmax != (NFS_DEF_ACDIRMAX_MS*HZ)/1000 || showdefaults)+		seq_printf(m, ",acdirmaxms=%u", (nfss->acdirmax*1000)/HZ); 	for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) { 		if (nfss->flags & nfs_infop->flag) 			seq_puts(m, nfs_infop->str);@@ -1138,36 +1144,64 @@ static int nfs_parse_mount_options(char 				errors++; 				nfs_parse_invalid_value("acregmin"); 			} else-				mnt->acregmin = option;+				mnt->acregminms = option * 1000; 			break; 		case Opt_acregmax: 			if (match_int(args, &option) || option < 0) { 				errors++; 				nfs_parse_invalid_value("acregmax"); 			} else-				mnt->acregmax = option;+				mnt->acregmaxms = option * 1000; 			break; 		case Opt_acdirmin: 			if (match_int(args, &option) || option < 0) { 				errors++; 				nfs_parse_invalid_value("acdirmin"); 			} else-				mnt->acdirmin = option;+				mnt->acdirminms = option * 1000; 			break; 		case Opt_acdirmax: 			if (match_int(args, &option) || option < 0) { 				errors++; 				nfs_parse_invalid_value("acdirmax"); 			} else-				mnt->acdirmax = option;+				mnt->acdirmaxms = option * 1000;+			break;+		case Opt_acregminms:+			if (match_int(args, &option) || option < 0) {+				errors++;+				nfs_parse_invalid_value("acregmin");+			} else+				mnt->acregminms = option;+			break;+		case Opt_acregmaxms:+			if (match_int(args, &option) || option < 0) {+				errors++;+				nfs_parse_invalid_value("acregmax");+			} else+				mnt->acregmaxms = option;+			break;+		case Opt_acdirminms:+			if (match_int(args, &option) || option < 0) {+				errors++;+				nfs_parse_invalid_value("acdirmin");+			} else+				mnt->acdirminms = option;+			break;+		case Opt_acdirmaxms:+			if (match_int(args, &option) || option < 0) {+				errors++;+				nfs_parse_invalid_value("acdirmax");+			} else+				mnt->acdirmaxms = option; 			break; 		case Opt_actimeo: 			if (match_int(args, &option) || option < 0) { 				errors++; 				nfs_parse_invalid_value("actimeo"); 			} else-				mnt->acregmin = mnt->acregmax =-				mnt->acdirmin = mnt->acdirmax = option;+				mnt->acregminms = mnt->acregmaxms =+				mnt->acdirminms = mnt->acdirmaxms = option * 1000; 			break; 		case Opt_namelen: 			if (match_int(args, &option) || option < 0) {@@ -1596,10 +1630,10 @@ static int nfs_validate_mount_data(void 	args->flags		= (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); 	args->rsize		= NFS_MAX_FILE_IO_SIZE; 	args->wsize		= NFS_MAX_FILE_IO_SIZE;-	args->acregmin		= NFS_DEF_ACREGMIN;-	args->acregmax		= NFS_DEF_ACREGMAX;-	args->acdirmin		= NFS_DEF_ACDIRMIN;-	args->acdirmax		= NFS_DEF_ACDIRMAX;+	args->acregminms	= NFS_DEF_ACREGMIN_MS;+	args->acregmaxms	= NFS_DEF_ACREGMAX_MS;+	args->acdirminms	= NFS_DEF_ACDIRMIN_MS;+	args->acdirmaxms	= NFS_DEF_ACDIRMAX_MS; 	args->mount_server.port	= 0;	/* autobind unless user sets port */ 	args->nfs_server.port	= 0;	/* autobind unless user sets port */ 	args->nfs_server.protocol = XPRT_TRANSPORT_TCP;@@ -1643,10 +1677,10 @@ static int nfs_validate_mount_data(void 		args->wsize		= data->wsize; 		args->timeo		= data->timeo; 		args->retrans		= data->retrans;-		args->acregmin		= data->acregmin;-		args->acregmax		= data->acregmax;-		args->acdirmin		= data->acdirmin;-		args->acdirmax		= data->acdirmax;+		args->acregminms	= data->acregmin * 1000;+		args->acregmaxms	= data->acregmax * 1000;+		args->acdirminms	= data->acdirmin * 1000;+		args->acdirmaxms	= data->acdirmax * 1000;  		memcpy(&args->nfs_server.address, &data->addr, 		       sizeof(data->addr));@@ -1775,10 +1809,10 @@ nfs_compare_remount_data(struct nfs_serv 	    data->wsize != nfss->wsize || 	    data->retrans != nfss->client->cl_timeout->to_retries || 	    data->auth_flavors[0] != nfss->client->cl_auth->au_flavor ||-	    data->acregmin != nfss->acregmin / HZ ||-	    data->acregmax != nfss->acregmax / HZ ||-	    data->acdirmin != nfss->acdirmin / HZ ||-	    data->acdirmax != nfss->acdirmax / HZ ||+	    data->acregminms != (nfss->acregmin * 1000) / HZ ||+	    data->acregmaxms != (nfss->acregmax * 1000) / HZ ||+	    data->acdirminms != (nfss->acdirmin * 1000) / HZ ||+	    data->acdirmaxms != (nfss->acdirmax * 1000) / HZ || 	    data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || 	    data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || 	    memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr,@@ -1819,10 +1853,10 @@ nfs_remount(struct super_block *sb, int 	data->wsize = nfss->wsize; 	data->retrans = nfss->client->cl_timeout->to_retries; 	data->auth_flavors[0] = nfss->client->cl_auth->au_flavor;-	data->acregmin = nfss->acregmin / HZ;-	data->acregmax = nfss->acregmax / HZ;-	data->acdirmin = nfss->acdirmin / HZ;-	data->acdirmax = nfss->acdirmax / HZ;+	data->acregminms = (nfss->acregmin * 1000) / HZ;+	data->acregmaxms = (nfss->acregmax * 1000) / HZ;+	data->acdirminms = (nfss->acdirmin * 1000) / HZ;+	data->acdirmaxms = (nfss->acdirmax * 1000) / HZ; 	data->timeo = 10U * nfss->client->cl_timeout->to_initval / HZ; 	data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen; 	memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,@@ -2254,10 +2288,10 @@ static int nfs4_validate_mount_data(void  	args->rsize		= NFS_MAX_FILE_IO_SIZE; 	args->wsize		= NFS_MAX_FILE_IO_SIZE;-	args->acregmin		= NFS_DEF_ACREGMIN;-	args->acregmax		= NFS_DEF_ACREGMAX;-	args->acdirmin		= NFS_DEF_ACDIRMIN;-	args->acdirmax		= NFS_DEF_ACDIRMAX;+	args->acregminms	= NFS_DEF_ACREGMIN_MS;+	args->acregmaxms	= NFS_DEF_ACREGMAX_MS;+	args->acdirminms	= NFS_DEF_ACDIRMIN_MS;+	args->acdirmaxms	= NFS_DEF_ACDIRMAX_MS; 	args->nfs_server.port	= NFS_PORT; /* 2049 unless user set port= */ 	args->auth_flavors[0]	= RPC_AUTH_UNIX; 	args->auth_flavor_len	= 0;@@ -2306,15 +2340,15 @@ static int nfs4_validate_mount_data(void 		 * can deal with. 		 */ -		args->flags	= data->flags & NFS4_MOUNT_FLAGMASK;-		args->rsize	= data->rsize;-		args->wsize	= data->wsize;-		args->timeo	= data->timeo;-		args->retrans	= data->retrans;-		args->acregmin	= data->acregmin;-		args->acregmax	= data->acregmax;-		args->acdirmin	= data->acdirmin;-		args->acdirmax	= data->acdirmax;+		args->flags		= data->flags & NFS4_MOUNT_FLAGMASK;+		args->rsize		= data->rsize;+		args->wsize		= data->wsize;+		args->timeo		= data->timeo;+		args->retrans		= data->retrans;+		args->acregminms	= data->acregmin * 1000;+		args->acregmaxms	= data->acregmax * 1000;+		args->acdirminms	= data->acdirmin * 1000;+		args->acdirmaxms	= data->acdirmax * 1000; 		args->nfs_server.protocol = data->proto; 		nfs_validate_transport_protocol(args); Index: linux-2.6/include/linux/nfs_fs.h===================================================================--- linux-2.6.orig/include/linux/nfs_fs.h+++ linux-2.6/include/linux/nfs_fs.h@@ -20,10 +20,10 @@ #define NFS_MAX_UDP_TIMEOUT	(60*HZ) #define NFS_MAX_TCP_TIMEOUT	(600*HZ) -#define NFS_DEF_ACREGMIN	(3)-#define NFS_DEF_ACREGMAX	(60)-#define NFS_DEF_ACDIRMIN	(30)-#define NFS_DEF_ACDIRMAX	(60)+#define NFS_DEF_ACREGMIN_MS	(3000)+#define NFS_DEF_ACREGMAX_MS	(60000)+#define NFS_DEF_ACDIRMIN_MS	(30000)+#define NFS_DEF_ACDIRMAX_MS	(60000)  /*  * When flushing a cluster of dirty pages, there can be differentÿôèº{.nÇ+?·?®?­?+%?Ëÿ±éݶ¥?wÿº{.nÇ+?·¥?{±þwìþ)í?æèw*jg¬±¨¶????Ý¢jÿ¾«þG«?éÿ¢¸¢·¦j:+v?¨?wèjØm¶?ÿþø¯ù®w¥þ?àþf£¢·h??â?úÿ?Ù¥


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux