diff options
author | vmallika <vmallika@redhat.com> | 2016-02-10 06:39:22 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2016-03-10 02:43:24 -0800 |
commit | e0f71288d95469d7ae82473ef273c6ba43250a36 (patch) | |
tree | 3ec70fe1e5d6ece778ff3175b55db7470231a5e7 /xlators/features/snapview-server/src/snapview-server-helpers.c | |
parent | ecf6243bc435a00f3dd2495524cd6e48e2d56f72 (diff) |
uss/gluster: generate gfid for snapshot files from snapname and gfid
If 'a' and 'b' are hardlinks, we need to generate a virtual
gfid for these files so that the inode number for 'a' and 'b'
are same.
Generate gfid as below:
gfid_of_a = MD5(snapname + back_end_gfid(a))
if '/dir1/a' and '/dir2/b' are hardlinks, then inode number should be
same for
all below files:
/mnt/.snaps/snap1/dir1/a
/mnt/.snaps/snap1/dir2/b
/mnt/dir1/.snaps/snap1/a
/mnt/dir2/.snaps/snap1/b
Change-Id: Ifda793455610e554f3f1e4cbb90d44c02cda4b0f
BUG: 1171703
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/9255
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server/src/snapview-server-helpers.c')
-rw-r--r-- | xlators/features/snapview-server/src/snapview-server-helpers.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c index 38ca7ae6342..dd2e891a849 100644 --- a/xlators/features/snapview-server/src/snapview-server-helpers.c +++ b/xlators/features/snapview-server/src/snapview-server-helpers.c @@ -330,6 +330,21 @@ out: } void +svs_uuid_generate (uuid_t gfid, char *snapname, uuid_t origin_gfid) +{ + unsigned char md5_sum[MD5_DIGEST_LENGTH] = {0}; + char ino_string[NAME_MAX + 32] = ""; + int ret = 0; + + GF_ASSERT (snapname); + + ret = snprintf (ino_string, sizeof (ino_string), "%s%s", + snapname, uuid_utoa(origin_gfid)); + MD5((unsigned char *)ino_string, strlen(ino_string), md5_sum); + gf_uuid_copy (gfid, md5_sum); +} + +void svs_fill_ino_from_gfid (struct iatt *buf) { uint64_t temp_ino = 0; |