summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-05-28 04:42:51 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-03 00:42:20 -0700
commit9c7f9475f48ea2ea5ca2e275ba6554acd24f817c (patch)
treefa09099eaa74bea3546e71cdbc002bafa81df9f7
parent57dc67ce5583ebaaa8c96900b6f279752b896e31 (diff)
booster: attr_timeout: Read timeout from booster fstab
In order to expose the timeout values for stat and inode caching, this commit introduces a new fstab option "attr_timeout" that defines the number of seconds for which a looked up inode or a stat()'ed structure is valid in the cache. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--booster/src/booster_fstab.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/booster/src/booster_fstab.c b/booster/src/booster_fstab.c
index dba785b5b..0a1282d68 100644
--- a/booster/src/booster_fstab.c
+++ b/booster/src/booster_fstab.c
@@ -26,6 +26,9 @@
#include <stdlib.h>
#include <libglusterfsclient.h>
+/* The default timeout for inode and stat cache. */
+#define BOOSTER_DEFAULT_ATTR_TIMEO 5 /* In Secs */
+
/* Prepare to begin reading and/or writing mount table entries from the
beginning of FILE. MODE is as for `fopen'. */
glusterfs_fstab_t *
@@ -362,6 +365,9 @@ booster_mount (struct glusterfs_mntent *ent)
{
char *opt = NULL;
glusterfs_init_params_t ipars;
+ time_t timeout = BOOSTER_DEFAULT_ATTR_TIMEO;
+ char *timeostr = NULL;
+ char *endptr = NULL;
if (!ent)
return;
@@ -385,6 +391,17 @@ booster_mount (struct glusterfs_mntent *ent)
if (opt)
ipars.loglevel = get_option_value (opt);
+ /* Attribute cache timeout */
+ opt = glusterfs_fstab_hasoption (ent, "attr_timeout");
+ if (opt) {
+ timeostr = get_option_value (opt);
+ if (timeostr)
+ timeout = strtol (timeostr, &endptr, 10);
+ }
+
+ ipars.lookup_timeout = timeout;
+ ipars.stat_timeout = timeout;
+
glusterfs_mount (ent->mnt_dir, &ipars);
clean_init_params (&ipars);
}