From ce8a569e9f18cfff2f2befe259c2022d9b37538f Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 14 Sep 2011 09:50:45 +0530 Subject: performance/io-cache,quick-read: increase cache-size limit Does the following: 1. Increases cache-size limit from 6GB to 32GB. 2. Prevents 'volume set'from failing when cache-size is set over the limit. Just issues a warning. 3. Performs check on cache-size by comparing with total system memory available in init () and reconfigure () methods. Change-Id: I7dd4d8c53051b89a293696abf1ee8dc237e39a20 BUG: 3495 Reviewed-on: http://review.gluster.com/409 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Vijay Bellur --- libglusterfs/src/common-utils.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index b2e91608b..2d4415f50 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1896,3 +1896,34 @@ gf_path_strip_trailing_slashes (char *path) return; } + +uint64_t +get_mem_size () +{ + uint64_t memsize = -1; + +#ifdef __linux__ + FILE *fp = NULL; + char line[1028] = {0,}; + + fp = fopen ("/proc/meminfo", "r"); + if (!fp) { + gf_log ("common-utils", GF_LOG_DEBUG, + "Could not open /proc/meminfo"); + return memsize; + } + + while (fgets (line, sizeof (line), fp) != 0) { + if (strncmp (line, "MemTotal:", 9) == 0) { + sscanf (line, "%*s %"SCNu64" kB", &memsize); + memsize *= 1024; //convert to bytes + gf_log ("common-utils", GF_LOG_INFO, + "Total Mem: %"PRIu64, memsize); + break; + } + } +#endif + // TODO: Methods for other platforms + + return memsize; +} -- cgit