[Ocfs2-tools-devel] [PATCH 4/9] ocfs2-tools: add xattr support in mkfs.ocfs2

Tiger Yang tiger.yang at oracle.com
Sat Jan 24 00:03:15 PST 2009


This patch add support for new feature xattr in mkfs.ocfs2.
Xattr is an incompatible feature, need option --fs-features=xattr
or --fs-feature-level=max-features to enable it.

Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
---
 libocfs2/feature_string.c  |   12 +++++++++++-
 mkfs.ocfs2/mkfs.c          |    6 ++++++
 mkfs.ocfs2/mkfs.ocfs2.8.in |    5 +++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c
index 061d5fb..dd76b5c 100644
--- a/libocfs2/feature_string.c
+++ b/libocfs2/feature_string.c
@@ -74,7 +74,8 @@ static ocfs2_fs_options feature_level_defaults[] = {
 	 OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC |
 	 OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP |
 	 OCFS2_FEATURE_INCOMPAT_INLINE_DATA |
-	 OCFS2_FEATURE_INCOMPAT_META_ECC,
+	 OCFS2_FEATURE_INCOMPAT_META_ECC |
+	 OCFS2_FEATURE_INCOMPAT_XATTR,
 	 OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_FEATURE_LEVEL_MAX_FEATURES */
 };
 
@@ -117,6 +118,11 @@ static struct fs_feature_flags ocfs2_supported_features[] = {
 		{0, OCFS2_FEATURE_INCOMPAT_META_ECC, 0},
 	},
 	{
+		"xattr",
+		{0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
+		{0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
+	},
+	{
 		NULL,
 		{0, 0, 0},
 		{0, 0, 0}
@@ -180,6 +186,10 @@ static struct feature_name ocfs2_feature_names[] = {
 		.fn_flag = {0, OCFS2_FEATURE_INCOMPAT_META_ECC, 0},
 	},
 	{
+		.fn_name = "Xattr",
+		.fn_flag = {0, OCFS2_FEATURE_INCOMPAT_XATTR, 0},
+	},
+	{
 		.fn_name = NULL,
 	},
 };
diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 033af88..161b065 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -2005,6 +2005,12 @@ format_superblock(State *s, SystemFileDiskRecord *rec,
 	 */
 	s->feature_flags.opt_compat &= ~OCFS2_FEATURE_COMPAT_BACKUP_SB;
 
+	if (s->feature_flags.opt_incompat & OCFS2_FEATURE_INCOMPAT_XATTR) {
+		di->id2.i_super.s_xattr_inline_size =
+						OCFS2_MIN_XATTR_INLINE_SIZE;
+		di->id2.i_super.s_uuid_hash = xattr_uuid_hash(s->uuid);
+	}
+
 	di->id2.i_super.s_feature_incompat = s->feature_flags.opt_incompat;
 	di->id2.i_super.s_feature_compat = s->feature_flags.opt_compat;
 	di->id2.i_super.s_feature_ro_compat = s->feature_flags.opt_ro_compat;
diff --git a/mkfs.ocfs2/mkfs.ocfs2.8.in b/mkfs.ocfs2/mkfs.ocfs2.8.in
index 86e284a..4d28b25 100644
--- a/mkfs.ocfs2/mkfs.ocfs2.8.in
+++ b/mkfs.ocfs2/mkfs.ocfs2.8.in
@@ -136,6 +136,11 @@ Enable inline-data support. If this feature is turned on, /fIOCFS2/fR will store
 \fBextended-slotmap\fR
 The slot-map is a hidden file on an \fIOCFS2\fR fs which is used to map mounted nodes to system file resources. The extended slot map allows a larger range of possible node numbers, which is useful for userspace cluster stacks. This feature is automatically turned on when needed, thus users have no need to turn this on manually. Available in the file system bundled with Linux kernels 2.6.27 and later.
 .RE
+.RS 1.2i
+.TP
+\fBxattr\fR
+Enable support for extended attribute.
+.RE
 
 .TP
 \fB\-\-fs\-feature\-level=\fR\fR\fIfeature\-level\fR
-- 
1.5.4.4




More information about the Ocfs2-tools-devel mailing list