From 2822157056d8347518f7e1b8bf9ee04bea7286ae Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Fri, 3 Sep 2010 13:58:11 +0000 Subject: gfid: introduce uuid based handles for inodes gfid represents a gluter file id. This is a universally unique id assigned to a logical inode, independent of the inode numbers assigned by the various backend filesystems to that file/directory. The gfid of a file/directory will be the same on servers depending on the cluster translator in picture. The same gfid can be used as a handle across layers of various translators and across servers and clients. This was not the case previously as the cluster translators would pick the backend inode number from one of the servers and convert that into a logical inode number by performing some mathematical transforms. This new technique of addressing inodes also makes dynamic volume management have a more robust implementation as the file handles remain the same on all versions of the graphs, and allows for seamless NFS daemon restarts as well. This change makes way for server originating communication which was not possible earlier as the servers did not have any reliable way of addressing client side inodes at all. gfid solves this problem by preserving the same uuid as the handle on all the servers and across all clients Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati Signed-off-by: Vijay Bellur BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- configure.ac | 3 +++ libglusterfs/src/Makefile.am | 2 +- libglusterfs/src/iatt.h | 2 ++ libglusterfs/src/inode.h | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b2cad35de74..cdeadb2b1c8 100644 --- a/configure.ac +++ b/configure.ac @@ -422,6 +422,9 @@ AC_SUBST(RLLIBS) CONTRIBDIR='$(top_srcdir)/contrib' AC_SUBST(CONTRIBDIR) +INCLUDES='-I$(top_srcdir)/libglusterfs/src -I$(CONTRIBDIR)/uuid' +AC_SUBST(INCLUDES) + AM_CONDITIONAL([GF_DARWIN_HOST_OS], test "${GF_HOST_OS}" = "GF_DARWIN_HOST_OS") AC_OUTPUT diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index f6c2cf8555b..3513419ebc9 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -1,6 +1,6 @@ libglusterfs_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) -libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" -D$(GF_HOST_OS) -I$(CONTRIBDIR)/rbtree -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" -I$(CONTRIBDIR)/md5 -I$(CONTRIBDIR)/uuid +libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" -D$(GF_HOST_OS) -I$(CONTRIBDIR)/rbtree -DSCHEDULERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/scheduler\" -I$(CONTRIBDIR)/md5 libglusterfs_la_LIBADD = @LEXLIB@ diff --git a/libglusterfs/src/iatt.h b/libglusterfs/src/iatt.h index ef64f9afc95..e67d714c2a7 100644 --- a/libglusterfs/src/iatt.h +++ b/libglusterfs/src/iatt.h @@ -31,6 +31,7 @@ #include #include "compat.h" +#include "uuid.h" typedef enum { IA_INVAL = 0, @@ -59,6 +60,7 @@ typedef struct { struct iatt { uint64_t ia_ino; /* inode number */ uint64_t ia_gen; /* generation number */ + uuid_t ia_gfid; uint64_t ia_dev; /* backing device ID */ ia_type_t ia_type; /* type of file */ ia_prot_t ia_prot; /* protection */ diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index 18081b8f8ce..a0bb8f8b57d 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -40,6 +40,7 @@ typedef struct _dentry dentry_t; #include "list.h" #include "xlator.h" #include "iatt.h" +#include "uuid.h" struct _inode_table { @@ -94,6 +95,7 @@ struct _inode_ctx { struct _inode { inode_table_t *table; /* the table this inode belongs to */ + uuid_t gfid; gf_lock_t lock; uint64_t nlookup; uint64_t generation; -- cgit