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

Tiger Yang tiger.yang at oracle.com
Tue Mar 24 19:48:46 PDT 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 +++++
 mount.ocfs2/mount.ocfs2.8.in |    8 ++++++++
 4 files changed, 30 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..c9f6999 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 = ocfs2_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..3a3b147 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. ACLs and security linux based on this feature.
+.RE
 
 .TP
 \fB\-\-fs\-feature\-level=\fR\fR\fIfeature\-level\fR
diff --git a/mount.ocfs2/mount.ocfs2.8.in b/mount.ocfs2/mount.ocfs2.8.in
index 3190ba5..d835f8d 100644
--- a/mount.ocfs2/mount.ocfs2.8.in
+++ b/mount.ocfs2/mount.ocfs2.8.in
@@ -33,6 +33,14 @@ The file system only update atime if the previous atime is older than mtime or c
 The file system will not update access time.
 
 .TP
+\fBacl\fR
+Enables POSIX ACLs(Access Control Lists) support.
+
+.TP
+\fBuser_xattr / nouser_xattr\fR
+Enables / disable Extended User Attributes.
+
+.TP
 \fBcommit=nrsec\fR
 Sync all data and metadata every nrsec seconds. The default value is 5 seconds.
 Zero means default.
-- 
1.5.4.1




More information about the Ocfs2-tools-devel mailing list