diff options
| author | Krishnan Parthasarathi <kparthas@redhat.com> | 2014-02-12 17:23:28 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-02-14 04:18:26 -0800 | 
| commit | a78dfebb7343671b0a3a0af8b46951894a3cf7a4 (patch) | |
| tree | 846be0e1c612c6bb91a69716bd694bb99a512eda | |
| parent | 0a8abcc5d0b727746a2ac6c0d5729700bfea742b (diff) | |
add build-gfid option to enable pgfid tracking ...
.. for inode to pathname mapping
Change-Id: I0486d85b02e86d739fc1d8ea16d118fb666abf60
BUG: 1064863
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6989
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | tests/basic/pgfid-feat.t | 36 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 16 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 5 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 2 | 
4 files changed, 55 insertions, 4 deletions
diff --git a/tests/basic/pgfid-feat.t b/tests/basic/pgfid-feat.t new file mode 100644 index 000000000..8784cc7bf --- /dev/null +++ b/tests/basic/pgfid-feat.t @@ -0,0 +1,36 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +function get_ancestry_path() { +	local path=$1 +	local ancestry=$(getfattr --absolute-names -e text -n glusterfs.ancestry.path "$M0/$path" | grep "^glusterfs.ancestry.path" | cut -d"=" -f2 | tr -d \"); +	echo $ancestry; +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2  $H0:$B0/${V0}{1,2,3,4}; +TEST $CLI volume start $V0; +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +TEST $CLI volume set $V0 build-pgfid on; + +TEST mkdir $M0/a; +TEST touch $M0/a/b; + +getfattr -e text -n glusterfs.ancestry.path "$M0/a/b" | grep "^glusterfs.ancestry.path" | cut -d"=" -f2 | tr -d \"; +EXPECT "/a/b" get_ancestry_path "/a/b"; + +TEST $CLI volume set $V0 build-pgfid off; +TEST ! getfattr -e text -n "glusterfs.ancestry.path" $M0/a/b; + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 3bb2f9a63..7cb858b01 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1423,6 +1423,7 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,          glusterd_brickinfo_t *brickinfo     = NULL;          char changelog_basepath[PATH_MAX]   = {0,};          gf_boolean_t          quota_enabled = _gf_true; +        gf_boolean_t          pgfid_feat    = _gf_false;          char                 *value         = NULL;          brickinfo = param; @@ -1449,6 +1450,15 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,                          goto out;          } +        ret = glusterd_volinfo_get (volinfo, +                                    "update-link-count-parent", +                                    &value); +        if (value) { +                ret = gf_string2boolean (value, &pgfid_feat); +                if (ret) +                        goto out; +        } +          xl = volgen_graph_add (graph, "storage/posix", volname);          if (!xl)                  return -1; @@ -1462,9 +1472,9 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,          if (ret)                  return -1; -        if (quota_enabled) +        if (quota_enabled || pgfid_feat)                  xlator_set_option (xl, "update-link-count-parent", -                                   value); +                                   "on");          ret = check_and_add_debug_xl (graph, set_dict, volname,                                        "posix"); @@ -1981,7 +1991,7 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out)          int                      ret = -1;          char                    *def_val = NULL;          char                    *descr = NULL; -        char                     output_string[25600] = {0, }; +        char                     output_string[51200] = {0, };          char                    *output = NULL;          char                     tmp_str[2048] = {0, };  #if (HAVE_LIB_XML) diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index ab8cefedd..6e7a80b92 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1439,6 +1439,11 @@ struct volopt_map_entry glusterd_volopt_map[] = {            .voltype     = "storage/posix",            .op_version  = 3          }, +        { .option      = "update-link-count-parent", +          .key         = "storage.build-pgfid", +          .voltype     = "storage/posix", +          .op_version  = 4 +        },          { .key         = "storage.bd-aio",            .voltype     = "storage/bd",            .op_version  = 3 diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 64465c618..ce777a4cb 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -5764,7 +5764,7 @@ struct volume_options options[] = {  	},          { .key = {"update-link-count-parent"},            .type = GF_OPTION_TYPE_BOOL, -          .default_value = "false", +          .default_value = "off",            .description = "Enable placeholders for gfid to path conversion"          },          { .key  = {NULL} }  | 
