From 9c7f9475f48ea2ea5ca2e275ba6554acd24f817c Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Thu, 28 May 2009 04:42:51 +0000 Subject: 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 --- booster/src/booster_fstab.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'booster/src') diff --git a/booster/src/booster_fstab.c b/booster/src/booster_fstab.c index dba785b5b4b..0a1282d686b 100644 --- a/booster/src/booster_fstab.c +++ b/booster/src/booster_fstab.c @@ -26,6 +26,9 @@ #include #include +/* 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); } -- cgit