From 704961a39ffd019487e36ac6dbd425399cb85cf2 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Fri, 4 Oct 2019 11:17:44 +0300 Subject: Multiple files: make root gfid a static variable In many places we use it, compare to it, etc. It could be a static variable, as it really doesn't change. I think it's better than initializing to 0 and then doing gfid[15] = 1 or other tricks. I think there are additional oppportunuties to make more variables static. This is an attempt at an easy one. Change-Id: I7f23a30a94056d8f043645371ab841cbd0f90d19 updates: bz#1193929 Signed-off-by: Yaniv Kaul --- xlators/cluster/dht/src/dht-common.c | 5 +---- xlators/cluster/dht/src/dht-helper.c | 7 +------ xlators/cluster/dht/src/dht-rebalance.c | 5 +---- 3 files changed, 3 insertions(+), 14 deletions(-) (limited to 'xlators/cluster/dht') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 232685bd56d..b295ce8bd03 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -6395,9 +6395,7 @@ dht_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) int i = -1; inode_t *inode = NULL; inode_table_t *itable = NULL; - uuid_t root_gfid = { - 0, - }; + static uuid_t root_gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; loc_t newloc = { 0, }; @@ -6423,7 +6421,6 @@ dht_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) } loc = &local->loc2; - root_gfid[15] = 1; inode = inode_find(itable, root_gfid); if (!inode) { diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 980a562deb2..9d3e3a3a0b2 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -1917,9 +1917,7 @@ dht_heal_path(xlator_t *this, char *path, inode_table_t *itable) }; char *bname = NULL; char *save_ptr = NULL; - uuid_t gfid = { - 0, - }; + static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; char *tmp_path = NULL; tmp_path = gf_strdup(path); @@ -1927,9 +1925,6 @@ dht_heal_path(xlator_t *this, char *path, inode_table_t *itable) goto out; } - memset(gfid, 0, 16); - gfid[15] = 1; - gf_uuid_copy(loc.pargfid, gfid); loc.parent = inode_ref(itable->root); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 0bf499abbf3..d4e639db704 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -2447,15 +2447,12 @@ void dht_build_root_inode(xlator_t *this, inode_t **inode) { inode_table_t *itable = NULL; - uuid_t root_gfid = { - 0, - }; + static uuid_t root_gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; itable = inode_table_new(0, this); if (!itable) return; - root_gfid[15] = 1; *inode = inode_find(itable, root_gfid); } -- cgit