summaryrefslogtreecommitdiffstats
path: root/booster
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:28:24 -0700
commit1fea167f86ed4501ed01b5c678cddc7c815f1a5b (patch)
treedd0d48870b2f8cbbdeee604feaa57bda154c67fc /booster
parentbc99744f209d2c6905f858e9ab44d09fb661e94a (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>
Diffstat (limited to 'booster')
-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 dba785b..0a1282d 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);
}