[dpdk-dev] cfgfile: Fix for Reading Files on nfs filesystem.

Message ID 1435162530-9272-1-git-send-email-danielx.t.mrzyglod@intel.com (mailing list archive)
State Rejected, archived
Headers

Commit Message

Daniel Mrzyglod June 24, 2015, 4:15 p.m. UTC
  The problem occure when we have config files on NFS filesystem.
Solution with minimal change to library is to add buffer for I/O operations.
Without buffering there is  3-10% of faulty Reading from NFS.

The problem seems to be only NFS filesystem.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 lib/librte_cfgfile/rte_cfgfile.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Thomas Monjalon June 24, 2015, 4:23 p.m. UTC | #1
2015-06-24 18:15, Daniel Mrzyglod:
> The problem occure when we have config files on NFS filesystem.

You forgot to describe the problem.

> Solution with minimal change to library is to add buffer for I/O operations.
> Without buffering there is  3-10% of faulty Reading from NFS.
> 
> The problem seems to be only NFS filesystem.
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
  
Daniel Mrzyglod June 26, 2015, 8:25 a.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Wednesday, June 24, 2015 6:16 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] cfgfile: Fix for Reading Files on nfs filesystem.
> 
> The problem occure when we have config files on NFS filesystem.
> Solution with minimal change to library is to add buffer for I/O operations.
> Without buffering there is  3-10% of faulty Reading from NFS.
> 
> The problem seems to be only NFS filesystem.
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
>  lib/librte_cfgfile/rte_cfgfile.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
> index b81c273..6105e0c 100644
> --- a/lib/librte_cfgfile/rte_cfgfile.c
> +++ b/lib/librte_cfgfile/rte_cfgfile.c
> @@ -93,10 +93,13 @@ rte_cfgfile_load(const char *filename, int flags)
>  	int curr_section = -1;
>  	int curr_entry = -1;
>  	char buffer[256];
> +	char f_streambuff[BUFSIZ];
>  	int lineno = 0;
>  	struct rte_cfgfile *cfg = NULL;
> +	memset(f_streambuff,'\0',BUFSIZ);
> 
>  	FILE *f = fopen(filename, "r");
> +	setbuf( f, f_streambuff);
>  	if (f == NULL)
>  		return NULL;
> 
> --
> 2.1.0

Self NACK
  

Patch

diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
index b81c273..6105e0c 100644
--- a/lib/librte_cfgfile/rte_cfgfile.c
+++ b/lib/librte_cfgfile/rte_cfgfile.c
@@ -93,10 +93,13 @@  rte_cfgfile_load(const char *filename, int flags)
 	int curr_section = -1;
 	int curr_entry = -1;
 	char buffer[256];
+	char f_streambuff[BUFSIZ];
 	int lineno = 0;
 	struct rte_cfgfile *cfg = NULL;
+	memset(f_streambuff,'\0',BUFSIZ);
 
 	FILE *f = fopen(filename, "r");
+	setbuf( f, f_streambuff);
 	if (f == NULL)
 		return NULL;