From ed4feadc8c60fce1d8d99e0732351b92230d6321 Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 10 Feb 2016 06:39:22 +0530 Subject: uss/gluster: generate gfid for snapshot files from snapname and gfid This is a backport of http://review.gluster.org/#/c/9255/ 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 Change-Id: I917b2fe2915d88f69700bc8c3283e9c613e13bb8 BUG: 1316099 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/13656 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Rajesh Joseph --- .../features/snapview-server/src/snapview-server.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'xlators/features/snapview-server/src/snapview-server.h') diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h index c80d3456c30..f9249f9d828 100644 --- a/xlators/features/snapview-server/src/snapview-server.h +++ b/xlators/features/snapview-server/src/snapview-server.h @@ -105,6 +105,17 @@ } \ } while(0); +#define SVS_STRDUP(dst, src) \ + do { \ + if (dst && strcmp (src, dst)) { \ + GF_FREE (dst); \ + dst = NULL; \ + } \ + \ + if (!dst) \ + dst = gf_strdup (src); \ + } while (0) + int svs_mgmt_submit_request (void *req, call_frame_t *frame, glusterfs_ctx_t *ctx, @@ -133,6 +144,11 @@ struct svs_inode { from where the entry point was entered is saved. */ uuid_t pargfid; + + /* This is used to generate gfid for all sub files/dirs under this + * snapshot + */ + char *snapname; struct iatt buf; }; typedef struct svs_inode svs_inode_t; @@ -193,6 +209,9 @@ __svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd); svs_fd_t * svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd); +void +svs_uuid_generate (uuid_t gfid, char *snapname, uuid_t origin_gfid); + void svs_fill_ino_from_gfid (struct iatt *buf); -- cgit