diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 1af7a77cff1..779d6be34a4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1421,6 +1421,7 @@ brick_graph_add_posix (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, { int ret = -1; gf_boolean_t quota_enabled = _gf_true; + gf_boolean_t trash_enabled = _gf_false; gf_boolean_t pgfid_feat = _gf_false; char *value = NULL; xlator_t *xl = NULL; @@ -1435,6 +1436,13 @@ brick_graph_add_posix (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, goto out; } + ret = glusterd_volinfo_get (volinfo, VKEY_FEATURES_TRASH, &value); + if (value) { + ret = gf_string2boolean (value, &trash_enabled); + if (ret) + goto out; + } + ret = glusterd_volinfo_get (volinfo, "update-link-count-parent", &value); @@ -1459,7 +1467,7 @@ brick_graph_add_posix (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) goto out; - if (quota_enabled || pgfid_feat) + if (quota_enabled || pgfid_feat || trash_enabled) xlator_set_option (xl, "update-link-count-parent", "on"); out: @@ -1467,6 +1475,29 @@ out: } static int +brick_graph_add_trash (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, + dict_t *set_dict, glusterd_brickinfo_t *brickinfo) +{ + int ret = -1; + xlator_t *xl = NULL; + + xl = volgen_graph_add (graph, "features/trash", volinfo->volname); + if (!xl) + goto out; + ret = xlator_set_option (xl, "trash-dir", ".trashcan"); + if (ret) + goto out; + ret = xlator_set_option (xl, "brick-path", brickinfo->path); + if (ret) + goto out; + ret = xlator_set_option (xl, "trash-internal-op", "off"); + if (ret) + goto out; +out: + return ret; +} + +static int brick_graph_add_bd (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, dict_t *set_dict, glusterd_brickinfo_t *brickinfo) { @@ -2018,6 +2049,7 @@ static volgen_brick_xlator_t server_graph_table[] = { {brick_graph_add_acl, "acl"}, {brick_graph_add_changelog, "changelog"}, {brick_graph_add_bd, "bd"}, + {brick_graph_add_trash, "trash"}, {brick_graph_add_posix, "posix"}, }; |