Skip to contentSkip to conversation

multipath: Set the default max_fds to the system max

PATCH Applied Benjamin Marzinski 2 participants 2 messages Nov 12, 2011 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/1 multipath: Set the default max_fds to the system max

Since many people don't realize that they need to set max_fds until they run out of file descriptors, default to the system max.

---
 libmultipath/config.c |    2 +-
 libmultipath/dict.c   |    2 +-
 libmultipath/dict.h   |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
libmultipath/config.c +1 -1
Index: multipath-tools-111111/libmultipath/config.c
===================================================================
@@ -493,7 +493,7 @@ load_config (char * file)
 	conf->dev_type = DEV_NONE;
 	conf->minio = DEFAULT_MINIO;
 	conf->minio_rq = DEFAULT_MINIO_RQ;
-	conf->max_fds = 0;
+	get_sys_max_fds(&conf->max_fds);
 	conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);
 	conf->bindings_read_only = 0;
 	conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
libmultipath/dict.c +1 -1
Index: multipath-tools-111111/libmultipath/dict.c
===================================================================
@@ -255,7 +255,7 @@ def_minio_rq_handler(vector strvec)
 	return 0;
 }
 
-static int
+int
 get_sys_max_fds(int *max_fds)
 {
 	FILE *file;
libmultipath/dict.h +1 -0
Index: multipath-tools-111111/libmultipath/dict.h
===================================================================
@@ -6,5 +6,6 @@
 #endif
 
 void init_keywords(void);
+int get_sys_max_fds(int *);
 
 #endif /* _DICT_H */
#1 lore raw
Quoted 3 lines · Benjamin Marzinski

Since many people don't realize that they need to set max_fds until they run out of file descriptors, default to the system max.

Applied

Quoted 44 lines
---
 libmultipath/config.c |    2 +-
 libmultipath/dict.c   |    2 +-
 libmultipath/dict.h   |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Index: multipath-tools-111111/libmultipath/config.c
===================================================================

libmultipath/config.c +1 -1
@@ -493,7 +493,7 @@ load_config (char * file)
 	conf->dev_type = DEV_NONE;
 	conf->minio = DEFAULT_MINIO;
 	conf->minio_rq = DEFAULT_MINIO_RQ;
-	conf->max_fds = 0;
+	get_sys_max_fds(&conf->max_fds);
 	conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);
 	conf->bindings_read_only = 0;
 	conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);

Index: multipath-tools-111111/libmultipath/dict.c
===================================================================

libmultipath/dict.c +1 -1
@@ -255,7 +255,7 @@ def_minio_rq_handler(vector strvec)
 	return 0;
 }
 
-static int
+int
 get_sys_max_fds(int *max_fds)
 {
 	FILE *file;

Index: multipath-tools-111111/libmultipath/dict.h
===================================================================

libmultipath/dict.h +1 -0
@@ -6,5 +6,6 @@
 #endif
 
 void init_keywords(void);
+int get_sys_max_fds(int *);
 
 #endif /* _DICT_H */