diff options
Diffstat (limited to 'xlators/performance/quick-read/src/quick-read.c')
| -rw-r--r-- | xlators/performance/quick-read/src/quick-read.c | 63 | 
1 files changed, 14 insertions, 49 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 044b00fd58d..465881080a4 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -3172,64 +3172,29 @@ mem_acct_init (xlator_t *this)  int -validate_options (xlator_t *this, dict_t *options, char **op_errstr) +validate_options (xlator_t *this, char **op_errstr)  { -        char         *str           = NULL; -        int32_t       ret           = -1; -        int32_t       cache_timeout = 0; -        uint64_t      cache_size    = 0; +        int                 ret = 0; +        volume_opt_list_t  *vol_opt = NULL; +        volume_opt_list_t  *tmp;          if (!this) { +                gf_log (this->name, GF_LOG_DEBUG, "'this' not a valid ptr"); +                ret =-1;                  goto out;          } -        ret = dict_get_str (this->options, "cache-timeout", &str); -        if (ret == 0) { -                ret = gf_string2uint_base10 (str, -                                             (unsigned int *)&cache_timeout); -                if (ret != 0) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "invalid cache-timeout value %s", str); -                        *op_errstr = "Invalid Format!!"; -                        ret = -1; -                        goto out; -                } -                if (ret < 1  || ret > 60) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "invalid cache-timeout value %s", str); -                        *op_errstr = "Range 1 <= value <= 60"; -                        ret = -1; -                        goto out; -                } -        } - -        ret = dict_get_str (this->options, "cache-size", &str); -        if (ret == 0) { -                ret = gf_string2bytesize (str, &cache_size); -                if (ret != 0) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "invalid cache-size value %s", str); -                        ret = -1; -                        goto out; -                } -                if (cache_size > 6 * GF_UNIT_GB) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "invalid cache-size value %s", str); -                        *op_errstr = "Range 4mb <= value <= 6gb"; -                        ret = -1; -                        goto out; -                } -                if (cache_size < 4* GF_UNIT_MB) { -                        gf_log (this->name, GF_LOG_ERROR, -                                "invalid cache-size value %s", str); -                        *op_errstr = "Range 4mb <= value <= 6gb"; -                        ret = -1; -                        goto out; -                } +        if (list_empty (&this->volume_options)) +                goto out; +        vol_opt = list_entry (this->volume_options.next, +                                      volume_opt_list_t, list); +         list_for_each_entry_safe (vol_opt, tmp, &this->volume_options, list) { +                ret = validate_xlator_volume_options_attacherr (this, +                                                                vol_opt->given_opt, +                                                                op_errstr);          } -        ret =0;  out:          return ret;  }  | 
