diff options
author | Amar Tumballi <amar@gluster.com> | 2009-04-03 08:27:44 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-03 22:02:25 +0530 |
commit | 8a5005ecf06f23f1607c0ff4111a21c00bd74205 (patch) | |
tree | d918103b0efafab231c2f8cff65e38e29c9e9c40 /xlators/cluster/dht/src/dht.c | |
parent | f235826215205ac626abb0ad475e7a89f7003da5 (diff) |
distribute to take care of available disk space while creating new dirs, and files.
distribute gets awareness about disk-space while creating the files
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht.c')
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index 3be6312937c..ddf95832f66 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -110,6 +110,15 @@ init (xlator_t *this) gf_string2boolean (lookup_unhashed_str, &conf->search_unhashed); } + + conf->min_free_disk = 10; + + if (dict_get_str (this->options, "min-free-disk", + &lookup_unhashed_str) == 0) { + gf_string2percent (lookup_unhashed_str, + &conf->min_free_disk); + } + ret = dht_init_subvolumes (this, conf); if (ret == -1) { @@ -121,6 +130,13 @@ init (xlator_t *this) goto err; } + conf->du_stats = CALLOC (conf->subvolume_cnt, sizeof (dht_du_t)); + if (!conf->du_stats) { + gf_log (this->name, GF_LOG_ERROR, + "memory allocation failed :("); + goto err; + } + LOCK_INIT (&conf->subvolume_lock); conf->gen = 1; @@ -147,6 +163,9 @@ err: if (conf->subvolume_status) FREE (conf->subvolume_status); + if (conf->du_stats) + FREE (conf->du_stats); + FREE (conf); } @@ -218,5 +237,8 @@ struct volume_options options[] = { { .key = {"lookup-unhashed"}, .type = GF_OPTION_TYPE_BOOL }, + { .key = {"min-free-disk"}, + .type = GF_OPTION_TYPE_PERCENT + }, { .key = {NULL} }, }; |