summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorZhou Zhengping <johnzzpcrystal@gmail.com>2016-07-16 21:43:58 -0400
committerJeff Darcy <jdarcy@redhat.com>2016-07-18 04:59:05 -0700
commit73b9ede7e115fab245b0f59d18e4d6cc4d297cec (patch)
tree88b9b003486c7b98241d93069e7fa773508b1284 /xlators/features
parent939184c6709db1391d38c892e098c20519d746cc (diff)
core: add a basis function to reduce verbose code
Change-Id: Icebe1b865edb317685e93f3ef11d98fd9b2c2e9a BUG: 1357226 Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com> Reviewed-on: http://review.gluster.org/14936 Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c9
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c10
2 files changed, 3 insertions, 16 deletions
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index a2b1a2c6793..7d75b09bae0 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -655,10 +655,7 @@ ga_virtual_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *buf, dict_t *xdata, struct iatt *postparent)
{
- int j = 0;
- int i = 0;
int ret = 0;
- uint64_t temp_ino = 0;
inode_t *cbk_inode = NULL;
inode_t *true_inode = NULL;
uuid_t random_gfid = {0,};
@@ -727,11 +724,7 @@ ga_virtual_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_uuid_copy (buf->ia_gfid, random_gfid);
- for (i = 15; i > (15 - 8); i--) {
- temp_ino += (uint64_t)(buf->ia_gfid[i]) << j;
- j += 8;
- }
- buf->ia_ino = temp_ino;
+ buf->ia_ino = gfid_to_ino (buf->ia_gfid);
unwind:
/* Lookup on non-existing gfid returns ESTALE.
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
index dd2e891a849..5bf41c2317b 100644
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
@@ -347,9 +347,6 @@ svs_uuid_generate (uuid_t gfid, char *snapname, uuid_t origin_gfid)
void
svs_fill_ino_from_gfid (struct iatt *buf)
{
- uint64_t temp_ino = 0;
- int j = 0;
- int i = 0;
xlator_t *this = NULL;
this = THIS;
@@ -362,11 +359,8 @@ svs_fill_ino_from_gfid (struct iatt *buf)
buf->ia_ino = -1;
goto out;
}
- for (i = 15; i > (15 - 8); i--) {
- temp_ino += (uint64_t)(buf->ia_gfid[i]) << j;
- j += 8;
- }
- buf->ia_ino = temp_ino;
+
+ buf->ia_ino = gfid_to_ino (buf->ia_gfid);
out:
return;
}