[Ocfs2-tools-devel] [PATCH 2/2] ocfs2-tools: set or clear s_uuid_hash in tunefs.ocfs2

Tiger Yang tiger.yang at oracle.com
Mon Feb 14 23:14:21 PST 2011


s_uuid_hash is used by two features indexed-dirs and xattr,
so set or clear it should concern the other feature's status.

Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
---
 tunefs.ocfs2/feature_indexed_dirs.c |    7 +++++++
 tunefs.ocfs2/feature_xattr.c        |   10 ++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/tunefs.ocfs2/feature_indexed_dirs.c b/tunefs.ocfs2/feature_indexed_dirs.c
index 5cdc86c..ead9a48 100644
--- a/tunefs.ocfs2/feature_indexed_dirs.c
+++ b/tunefs.ocfs2/feature_indexed_dirs.c
@@ -117,6 +117,10 @@ static int enable_indexed_dirs(ocfs2_filesys *fs, int flags)
 		goto out;
 	}
 
+	/* s_uuid_hash is also used by xattr */
+	if (!OCFS2_HAS_INCOMPAT_FEATURE(super, OCFS2_FEATURE_INCOMPAT_XATTR))
+		super->s_uuid_hash =
+			ocfs2_xattr_uuid_hash((unsigned char *)super->s_uuid);
 	/* set seed for indexed dir hash */
 	srand48(time(NULL));
 	super->s_dx_seed[0] = mrand48();
@@ -309,6 +313,9 @@ static int disable_indexed_dirs(ocfs2_filesys *fs, int flags)
 	OCFS2_CLEAR_INCOMPAT_FEATURE(super,
 				     OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS);
 
+	/* s_uuid_hash is also used by xattr */
+	if (!OCFS2_HAS_INCOMPAT_FEATURE(super, OCFS2_FEATURE_INCOMPAT_XATTR))
+		super->s_uuid_hash = 0;
 	super->s_dx_seed[0] = super->s_dx_seed[1] = super->s_dx_seed[2] = 0;
 
 	ret = ocfs2_write_super(fs);
diff --git a/tunefs.ocfs2/feature_xattr.c b/tunefs.ocfs2/feature_xattr.c
index ebe75e3..37b39e4 100644
--- a/tunefs.ocfs2/feature_xattr.c
+++ b/tunefs.ocfs2/feature_xattr.c
@@ -352,7 +352,10 @@ static int enable_xattr(ocfs2_filesys *fs, int flag)
 		goto out;
 	}
 
-	super->s_uuid_hash =
+	/* s_uuid_hash is also used by Indexed Dirs */
+	if (!OCFS2_HAS_INCOMPAT_FEATURE(super,
+					OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS))
+		super->s_uuid_hash =
 			ocfs2_xattr_uuid_hash((unsigned char *)super->s_uuid);
 	super->s_xattr_inline_size = OCFS2_MIN_XATTR_INLINE_SIZE;
 	OCFS2_SET_INCOMPAT_FEATURE(super, OCFS2_FEATURE_INCOMPAT_XATTR);
@@ -424,7 +427,10 @@ static int disable_xattr(ocfs2_filesys *fs, int flag)
 	}
 	tools_progress_step(prog, 1);
 
-	super->s_uuid_hash = 0;
+	/* s_uuid_hash is also used by Indexed Dirs */
+	if (!OCFS2_HAS_INCOMPAT_FEATURE(super,
+					OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS))
+		super->s_uuid_hash = 0;
 	super->s_xattr_inline_size = 0;
 	OCFS2_CLEAR_INCOMPAT_FEATURE(super, OCFS2_FEATURE_INCOMPAT_XATTR);
 
-- 
1.7.2.1




More information about the Ocfs2-tools-devel mailing list